[Tutor] dict.iteritems() in Python3, was Re: Tutor Digest, Vol 110, Issue 117
eryksun
eryksun at gmail.com
Tue Apr 30 23:42:13 CEST 2013
On Tue, Apr 30, 2013 at 1:44 PM, Peter Otten <__peter__ at web.de> wrote:
>
> d.items() --> list(d.items())
> d.iteritems() --> iter(d.items())
> d.viewitems() --> d.items()
>
> In short: items() and iteritems() were both dropped, and viewitems() was
> renamed items().
Following on from this, the iterator types weren't dropped, but
iteritems, iterkeys, itervalues were removed from the mapping API.
iter(d.items()) returns an item iterator similar to the old
d.iteritems(), but the name was corrected from the weird 'dictionary-'
prefix to simply 'dict_'. Also, even though it's instantiated by a
view, the 3.x iterator references the dict directly, not the view.
More information about the Tutor
mailing list