PyCQA / modernize

Modernizes Python code for eventual Python 3 migration. Built on top of fissix (a fork of lib2to3)
https://modernize.readthedocs.org/
Other
355 stars 51 forks source link

Fix transformation of non-iter dict methods in for loops #120

Closed takluyver closed 9 years ago

takluyver commented 9 years ago

Addresses issue #119 - it's not exactly what the author asked for, but I think it's better ;-)

For some reason, 2to3 only treats a for loop as a special context for iter* methods, so it will add a list() call to e.g. for x in d.values().

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.02%) to 95.64% when pulling 8a1ef249bf6b75393df60cfcf9615eca915f592e on takluyver:dict-methods-in-loops into 5ab6f019cc91e1269a403a15a12709400e4941b1 on python-modernize:master.

rsyring commented 9 years ago

thanks! I'll try it out and see if it solves my problem.

daira commented 9 years ago

LGTM.