[Python-Dev] Re: PEP 279 revisited

Neal Norwitz neal@metaslash.com
Wed, 24 Apr 2002 08:26:03 -0400


holger krekel wrote:

	[discussion on naming enumerate() items()]

> Additionally
> 
>    items(dict)==dict.items()
> 
> would be satisfied, so the analogy is better than 'rough'.

They are not equivalent, see below.

Neal
--

>>> d = {10:20} 
>>> print d.items()
[(10, 20)]
>>> print enumerate(d)
<enumerate object at 0x40208bcc>
>>> for x in enumerate(d): print x
... 
(0, 10)