[Checkins] SVN: zope.interface/branches/jinty-mem/src/zope/interface/interface.py Apply slots to Element, Attribute and Method classes. This causes breakage in zope.schema which can be fixed by a trivial patch.

Brian Sutherland jinty at web.de
Thu Nov 11 03:29:36 EST 2010


Log message for revision 118338:
  Apply slots to Element, Attribute and Method classes. This causes breakage in zope.schema which can be fixed by a trivial patch.

Changed:
  U   zope.interface/branches/jinty-mem/src/zope/interface/interface.py

-=-
Modified: zope.interface/branches/jinty-mem/src/zope/interface/interface.py
===================================================================
--- zope.interface/branches/jinty-mem/src/zope/interface/interface.py	2010-11-11 07:56:20 UTC (rev 118337)
+++ zope.interface/branches/jinty-mem/src/zope/interface/interface.py	2010-11-11 08:29:35 UTC (rev 118338)
@@ -51,7 +51,7 @@
     # infrastructure in place.
     #
     #implements(IElement)
-    __tagged_values = None
+    __slots__ = ('__tagged_values', '__doc__', '__name__')
 
     def __init__(self, __name__, __doc__=''):
         """Create an 'attribute' description
@@ -60,6 +60,7 @@
             __doc__ = __name__
             __name__ = None
 
+        self.__tagged_values = None
         self.__name__=__name__
         self.__doc__=__doc__
 
@@ -716,23 +717,26 @@
 Interface = InterfaceClass("Interface", __module__ = 'zope.interface')
 
 class Attribute(Element):
-    """Attribute descriptions
-    """
 
+    __slots__ = ('interface', '__doc__')
+
     # We can't say this yet because we don't have enough
     # infrastructure in place.
     #
     # implements(IAttribute)
 
-    interface = None
+    def __init__(self, __name__, __doc__=''):
+        Element.__init__(self, __name__, __doc__)
+        self.interface = None
 
 
 class Method(Attribute):
-    """Method interfaces
+    # Method interfaces
+    #
+    # The idea here is that you have objects that describe methods.
+    # This provides an opportunity for rich meta-data.
 
-    The idea here is that you have objects that describe methods.
-    This provides an opportunity for rich meta-data.
-    """
+    __slots__ = ('positional', 'required', 'optional', 'varargs', 'kwargs', '__doc__')
 
     # We can't say this yet because we don't have enough
     # infrastructure in place.



More information about the checkins mailing list