PyCQA / modernize

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

Incorrect changes on code using both iterkeys and next #206

Open Han-He opened 4 years ago

Han-He commented 4 years ago
➜ test python-modernize --version
modernize 0.7

after running python-modernize on test code

+from future import print_function
+import six
d = {"key": "value"}
-first_key = d.iterkeys().next()
+first_key = six.iterkeys(d)
print(first_key)

This is not equivalent and it should be changed to six.next(six.iterkeys(d))