Skip to content

Don't apply the list constructor if it's just iterating over #140

Open
@hayd

Description

@hayd

At the moment futurize always adds a list constructor around python 3 iterators. Doing this creates a unnecessary copy in python 2, and an unnecessary list in python 3.

# currently
for k in d.keys():
    pass

# becomes
for k in list(d.keys()):
    pass

Because we are iterating there's no need to make this a list either in python 2 or python 3.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions