[IronPython] Overriding __iter__ in dict subclass
Michael Foord
michael.foord at resolversystems.com
Tue Feb 19 17:31:23 CET 2008
Bug in IronPython 1 and 2.
IronPython 2.0 Alpha (2.0.0.800) on .NET 2.0.50727.832
Copyright (c) Microsoft Corporation. All rights reserved.
>>> class X(dict):
... __iter__ = lambda s: s.itervalues()
...
>>> a = X([(1, 'a'), (2, 'b'), (3, 'c')])
>>> for e in a:
... print e
...
1
2
3
>>>
IronPython 1.1
>>> class X(dict):
... __iter__ = lambda s: s.itervalues()
...
>>> a = X([(1, 'a'), (2, 'b'), (3, 'c')])
>>> for e in a:
... print e
...
1
2
3
>>>
CPython 2.4
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class X(dict):
... __iter__ = lambda s: s.itervalues()
...
>>> a = X([(1, 'a'), (2, 'b'), (3, 'c')])
>>>
>>> for e in a:
... print e
...
a
b
c
>>>
--
Michael Foord
Senior Software Engineer, Resolver Systems Ltd.
michael.foord at resolversystems.com
+44 (0) 20 7253 6372
We're hiring! http://www.resolversystems.com/jobs/
17a Clerkenwell Road, London EC1M 5RD, UK
VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329.
Registered address: 843 Finchley Road, London NW11 8NA, UK
More information about the Ironpython-users
mailing list