[Zope-dev] regression with Acquisition and __iter__ in Python 2.5 / Zope 2.12
Chris Withers
chris at simplistix.co.uk
Mon Apr 13 04:51:23 EDT 2009
Dieter Maurer wrote:
> It does not go wrong with Zope 2.11/Python 2.4, neither.
> Maybe, changes done for Python 2.5/2.6 compatibility broke something.
>
> Here is a simpler script to check for problems:
Indeed:
>>> class C:
... l=[1,2,3]
... def __getitem__(self, i):
... return self.l[i]
list(_)
...
from Acquisition import Implicit
class C(Implicit):
>>> c=C()
def __getitem__(self, i):
>>> iter(c)
<iterator object at 0xb7db8ecc>
>>> list(_)
iter(c)
[1, 2, 3]
>>>
list(_)
>>> from Acquisition import Implicit
iter(c2)
list(_)
>>> class C(Implicit):
... l=[1,2,3]
... def __getitem__(self, i):
... return self.l[i]
...
>>> c=C()
>>> iter(c)
<iterator object at 0xb7dbb38c>
>>> list(_)
[1, 2, 3]
>>> c2=C().__of__(c)
>>> iter(c2)
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: __iter__
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope-Dev
mailing list