Index: functional.py
===================================================================
--- functional.py	(revision 7018)
+++ functional.py	(working copy)
@@ -37,40 +37,43 @@
     """
     class __proxy__(Promise):
         # This inner class encapsulates the code that should be evaluated
-        # lazily. On calling of one of the magic methods it will force
-        # the evaluation and store the result. Afterwards, the result
-        # is delivered directly. So the result is memoized.
+        # lazily. On calling of one of the methods it will force the
+        # evaluation.
         def __init__(self, args, kw):
             self.__func = func
             self.__args = args
             self.__kw = kw
-            self.__dispatch = {}
+
+        @classmethod
+        def __class_init__(cls):
+            cls.__dispatch = {}
             for resultclass in resultclasses:
-                self.__dispatch[resultclass] = {}
+                cls.__dispatch[resultclass] = {}
                 for (k, v) in resultclass.__dict__.items():
-                    setattr(self, k, self.__promise__(resultclass, k, v))
-            self._delegate_str = str in resultclasses
-            self._delegate_unicode = unicode in resultclasses
-            assert not (self._delegate_str and self._delegate_unicode), "Cannot call lazy() with both str and unicode return types."
-            if self._delegate_unicode:
-                # Each call to lazy() makes a new __proxy__ object, so this
-                # doesn't interfere with any other lazy() results.
-                __proxy__.__unicode__ = __proxy__.__unicode_cast
-            elif self._delegate_str:
-                __proxy__.__str__ = __proxy__.__str_cast
+                    if hasattr(cls, k):
+                        continue
+                    setattr(cls, k, cls.__promise__(resultclass, k, v))
+            cls._delegate_str = str in resultclasses
+            cls._delegate_unicode = unicode in resultclasses
+            assert not (cls._delegate_str and cls._delegate_unicode), "Cannot call lazy() with both str and unicode return types."
+            if cls._delegate_unicode:
+                cls.__unicode__ = cls.__unicode_cast
+            elif cls._delegate_str:
+                cls.__str__ = cls.__str_cast
 
-        def __promise__(self, klass, funcname, func):
-            # Builds a wrapper around some magic method and registers that magic
-            # method for the given type and method name.
-            def __wrapper__(*args, **kw):
+        @classmethod
+        def __promise__(cls, resultclass, funcname, func):
+            # Builds a wrapper around a method and registers that method for
+            # the given type and method name.
+            def __wrapper__(self, *args, **kw):
                 # Automatically triggers the evaluation of a lazy value and
                 # applies the given magic method of the result type.
                 res = self.__func(*self.__args, **self.__kw)
                 return self.__dispatch[type(res)][funcname](res, *args, **kw)
 
-            if klass not in self.__dispatch:
-                self.__dispatch[klass] = {}
-            self.__dispatch[klass][funcname] = func
+            if resultclass not in cls.__dispatch:
+                cls.__dispatch[resultclass] = {}
+            cls.__dispatch[resultclass][funcname] = func
             return __wrapper__
 
         def __unicode_cast(self):
@@ -105,6 +108,8 @@
             # complicated for copying.
             memo[id(self)] = self
             return self
+    
+    __proxy__.__class_init__()
 
     def __wrapper__(*args, **kw):
         # Creates the proxy object, instead of the actual value.
