You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that python-modernize doesn't convert for k, v in d.items() to for k, v in list(d.items()), assuming that the use of items() was an accident in Python 2. This is not always the case - consider the following two functions:
When python-modernize is run on the code, it correctly modifies foo1 to return list(d.items()), but it doesn't modify foo2 to iterate over list(d.items()). In our code base this led to many subtle bugs because our Python 2 code was very careful to only use items() (and keys() and values()) because the dictionary was being modified.
Is there a way to opt out of the special-handling of items inside for?