[Python-porting] documentation bug
Nick Jacobson
nicksjacobson at yahoo.com
Wed Oct 22 02:36:16 CEST 2014
At http://python-future.org/compatible_idioms.html#iterating-through-dict-keys-values-items
It states:
# Python 2 and 3: option 2 from builtins import iteritems
but should be:
# Python 2 and 3: option 2 from future.utilsimportiteritems
...and in fact, help(iteritems) returns:
iteritems(obj, **kwargs)
Use this only if compatibility with Python versions before 2.7 is
required. Otherwise, prefer viewitems().
So perhaps it should be:
# Python 2.7+ and 3: option 2 from future.utilsimportviewitems
and the example updated to reflect this.
The above applies to itervalues as well.
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-porting/attachments/20141021/3f2580d5/attachment-0001.html>
More information about the Python-porting
mailing list