The dictionary fixer will automatically wrap lots of dictionary iterators with list(...) where it's not really needed, like for loops. This clutters the code and makes the conversion diffs have more "static" IMO.
So, I've been running modernize without libmodernize.fixes.fix_dict_six. Unfortunately, that means I have to manually go through and update things like the conversion of mydict.iteritems() to use the six version.
It would be really helpful IMO to break out the dictionary fixer into one or more fixers so more granularity can be applied when choosing which dictionary fixes someone would want to apply.
It shouldn't be wrapping things in list() when it's inside a for loop, though I also noticed it doing that recently. I'll see if I can work out what's going on.
120 should make it smarter about for loops - which isn't quite what you asked for, but it might solve your problem. We could also break them out into multiple fixers.
The dictionary fixer will automatically wrap lots of dictionary iterators with
list(...)
where it's not really needed, likefor
loops. This clutters the code and makes the conversion diffs have more "static" IMO.So, I've been running modernize without
libmodernize.fixes.fix_dict_six
. Unfortunately, that means I have to manually go through and update things like the conversion ofmydict.iteritems()
to use thesix
version.It would be really helpful IMO to break out the dictionary fixer into one or more fixers so more granularity can be applied when choosing which dictionary fixes someone would want to apply.