changeset 90:73aaee69ec44

Made Bottom a singleton class.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Fri, 29 May 2009 13:19:20 +0200
parents 3bb5d6df094a
children dacd3208ff1b
files pysmcl/range_analysis.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/range_analysis.py	Fri May 29 12:13:27 2009 +0200
+++ b/pysmcl/range_analysis.py	Fri May 29 13:19:20 2009 +0200
@@ -24,6 +24,17 @@
 
     e.g. for the expression x = 2-5 yields the range for x (Bottom(), Bottom())
     """
+
+    # storage for the instance reference
+    __instance = None
+
+    def __init__(self):
+        """ Create singleton instance """
+        # Check whether we already have an instance
+        if Bottom.__instance is None:
+            # Create and remember instance
+            Bottom.__instance = self
+
     def __eq__(self, other):
         if other is not None:
             return isinstance(other, Bottom)