Part 1: Py2->3 Futurize stage 2 without str-unicode, urllib changes (#406)#411
Conversation
|
/gcbrun |
|
This patch does git ls-files "*.py" | xargs futurize -w -n --stage2 -x libfuturize.fixes.fix_unicode_keep_u -x libfuturize.fixes.fix_future_standard_library_urllib -x libfuturize.fixes.fix_future_standard_library -x libfuturize.fixes.fix_object -x libfuturize.fixes.fix_basestring -x libfuturize.fixes.fix_future_builtins excludes some things that will take more time and will go in Q3 i think. |
|
had to fix up a lot of old_div after this futurize step, but i think good for cleanup. |
oliverchang
left a comment
There was a problem hiding this comment.
LGTM with just a minor remark. Looks like it's also failing lint right now.
There was a problem hiding this comment.
I'm a little surprised by these changes, since the previous version was using generators and this change makes it always convert the whole thing to a list. I would've expected the change to omit the list() call so that under Python 3 the behaviour is the same as before.
There was a problem hiding this comment.
https://stackoverflow.com/questions/17695456/why-does-python-3-need-dict-items-to-be-wrapped-with-list :( :( i can remove all the list() since it was just overcautionary but we probably have to rerun futurize sometime and need to find way so that it does not reconvert it again.
There was a problem hiding this comment.
Probably will convert to option 2 in https://python-future.org/compatible_idioms.html#iterating-through-dict-keys-values-items
# Python 2 and 3: option 3
from future.utils import iteritems
# or
from six import iteritems
for (key, value) in iteritems(heights):
...
Will think more tmrw.
There was a problem hiding this comment.
Using six sounds good! Converting everything to a list could potentially have issues because of extra memory etc.
|
/gcbrun |
|
/gcbrun |
|
/gcbrun |
|
/gcbrun |
|
/gcbrun |
|
/gcbrun |
No description provided.