Page MenuHomePhabricator

Make several Python scripts portable across Python2 and Python 3

Authored by serge-sans-paille on Nov 30 2018, 6:14 AM.

Diff Detail


Event Timeline

Conversion using the `futurize` script, then manual review. For the sake of reviewer sanity, I've left all the difficult part to further separate commits.

In general LGTM, as someone who's done a 2-3 conversion of similar scale before.

The only suggestion I'd make is to consider changing the __future__ imports to from __future__ import absolute_import, division, print_function
I found this gave the best consistency between 2 & 3. Probably you don't need it at this point, but once the conversion is done there's less to go wrong in future.

Use generic `from __future__ import ` line whenever it makes sense

joerg added a subscriber: joerg.Dec 2 2018, 11:29 AM

Can you split off the pure modernisation changes like new exception or print ? Those are completely non-contentious changes after all. I generally do not like the range and list related changes as many instances are clear regressions for the 2.x case. filter to list comprehension should IMO be a separate change as well, but those are much less problematic and often an improvement in terms of both performance and readability.

serge-sans-paille edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Dec 3 2018, 4:04 AM
This revision was automatically updated to reflect the committed changes.