This is an archive of the discontinued LLVM Phabricator instance.

[LNT] Python 3 support: use Python 3 idioms
ClosedPublic

Authored by thopre on Sep 20 2019, 1:28 AM.

Details

Summary

Replace Python 2 idioms for their Python 3 counterparts. These includes:

  • replace calls to X.sort() optionally followed by .reverse() by calls to sorted(X)
  • replace while 1 by while True

This was produced by running futurize's stage1 lib2to3.fixes.fix_idioms.

Diff Detail

Repository
rL LLVM

Event Timeline

thopre created this revision.Sep 20 2019, 1:28 AM
lnt/external/stats/stats.py
2027 ↗(On Diff #220967)

Should this sort be updated to sort in the desired order instead of calling reverse() after?

thopre updated this revision to Diff 221171.Sep 21 2019, 7:40 AM
thopre marked 2 inline comments as done.

Fold .reverse() into sorted()

thopre edited the summary of this revision. (Show Details)Sep 21 2019, 7:40 AM
thopre added inline comments.
lnt/external/stats/stats.py
2027 ↗(On Diff #220967)

Good catch and good idea! Done.

This revision is now accepted and ready to land.Sep 21 2019, 7:50 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2019, 8:19 AM