~cjwatson/storm/py3-dict

Viewing all changes in revision 511.

  • Committer: Colin Watson
  • Date: 2019-08-11 09:48:05 UTC
  • Revision ID: cjwatson@canonical.com-20190811094805-wcnd0h1j2gjpix0p
Handle Python 3's changes to dict iteration methods.

In most cases I opted for a somewhat pedantic translation of d.iterfoo() to
six.iterfoo(d) and d.foo() to list(six.iterfoo(d)), since there are enough
cases where this matters either for performance or to avoid iterating over a
dictionary while modifying it that it's simplest to be consistent.

There were a few cases where the Python 2 code was iterating over something
like d.items() when it didn't need to do a copy; I left those cases alone,
since they'll just become slightly more efficient under Python 3.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: