Skip to content

documentation error in items import #120

Closed
@nickjacobson

Description

@nickjacobson

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.utils import iteritems

...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.utils import viewitems

and the example updated to reflect this.

The above applies to itervalues as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions