diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-06 19:52:44 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-06 19:52:44 (GMT) |
commit | 62aa7dc7c9b279df9bfd23c3553b1c27725dc76b (patch) | |
tree | 66c7fd9944d22f175dc102e4a7eecfb661198759 /Lib/pprint.py | |
parent | 01362da7d00dc22e44f0c7da5c06767b8bd61882 (diff) | |
download | cpython-62aa7dc7c9b279df9bfd23c3553b1c27725dc76b.zip cpython-62aa7dc7c9b279df9bfd23c3553b1c27725dc76b.tar.gz cpython-62aa7dc7c9b279df9bfd23c3553b1c27725dc76b.tar.bz2 |
Issue #22721: An order of multiline pprint output of set or dict containing
orderable and non-orderable elements no longer depends on iteration order of
set or dict.
Diffstat (limited to 'Lib/pprint.py')
-rw-r--r-- | Lib/pprint.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Lib/pprint.py b/Lib/pprint.py index c79c713..723ea9c 100644 --- a/Lib/pprint.py +++ b/Lib/pprint.py @@ -86,14 +86,10 @@ class _safe_key: def __lt__(self, other): try: - rv = self.obj.__lt__(other.obj) + return self.obj < other.obj except TypeError: - rv = NotImplemented - - if rv is NotImplemented: - rv = (str(type(self.obj)), id(self.obj)) < \ - (str(type(other.obj)), id(other.obj)) - return rv + return ((str(type(self.obj)), id(self.obj)) < \ + (str(type(other.obj)), id(other.obj))) def _safe_tuple(t): "Helper function for comparing 2-tuples" |