[Zope-dev] New-style ExtensionClass

Florent Guillaume fg at nuxeo.com
Wed Oct 22 06:22:03 EDT 2003


In article <3F94057B.4020701 at zope.com> you write:
> 
> I've started work on a new-style ExtensionClass. This is a port
> of ExtensionClass to new-style classes.  This will provide a number
> of advantages:
> 
> - Use of new-style class features (e.g. descriptors) in Zope objects.
> 
> - Support for cyclic garbage collection.
> 
> - Ability to use new-style classes as base classes of Zope objects.
> 
> - Use of a version of ZODB that supports non-ExtensionClass classes.
> 
> - Pave the way for sharing code between Zope 2 and Zope 3.
> 
> I hope I can merge this into the Zope 2 head in a week or two.
> 
> This is a rather deep change and it is likely to cause some instability
> on the CVS head for a while.  I'm doing this now, rather than later,
> to give us plenty of time to find and fix problems before a Zope 2.8
> release.
> 
> Speaking of Zope 2.8, Jeremy Hylton has suggested that, perhaps, Zope 2.8
> should be a release that provides *only*:
> 
> - New-style ExtensionClass, and
> 
> - ZODB 3.3, featuring multi-version concurrency control,
> 
> plus any features that have been added to the head since the Zope 2.7
> branch was created.
> 
> This idea is pretty appealing to me.  I wonder what others think of it.
> 
> Jim

Excellent.
Will it also fix this particularity of ExtensionClass:

>>> from ExtensionClass import Base
... class A(Base):
...   def foo(self):
...     self.gee
...   def bar(self):
...     del self.gee
... 
>>> a=A()
>>> a.foo()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 3, in foo
AttributeError: gee
>>> a.bar()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 5, in bar
KeyError: gee

I.e., the fact that KeyError is raised whereas a normal class would
raise AttributeError.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg at nuxeo.com



More information about the Zope-Dev mailing list