summaryrefslogtreecommitdiffstats
path: root/Lib/reprlib.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2014-11-10 06:30:36 (GMT)
committerRaymond Hettinger <python@rcn.com>2014-11-10 06:30:36 (GMT)
commitffd842e1d6736d48d45e741e2006a181c9ad4272 (patch)
tree58ee53b876b716f223aef88c21a89b50ee0819e3 /Lib/reprlib.py
parent223bc2fe1653d21fc00ff8ebf1379cefadba808a (diff)
downloadcpython-ffd842e1d6736d48d45e741e2006a181c9ad4272.zip
cpython-ffd842e1d6736d48d45e741e2006a181c9ad4272.tar.gz
cpython-ffd842e1d6736d48d45e741e2006a181c9ad4272.tar.bz2
Issue #22824: Updated reprlib output format for sets to use set literals.
Diffstat (limited to 'Lib/reprlib.py')
-rw-r--r--Lib/reprlib.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/reprlib.py b/Lib/reprlib.py
index b7fda23..5eb5ca3 100644
--- a/Lib/reprlib.py
+++ b/Lib/reprlib.py
@@ -87,12 +87,16 @@ class Repr:
return self._repr_iterable(x, level, header, '])', self.maxarray)
def repr_set(self, x, level):
+ if not x:
+ return 'set()'
x = _possibly_sorted(x)
- return self._repr_iterable(x, level, 'set([', '])', self.maxset)
+ return self._repr_iterable(x, level, '{', '}', self.maxset)
def repr_frozenset(self, x, level):
+ if not x:
+ return 'frozenset()'
x = _possibly_sorted(x)
- return self._repr_iterable(x, level, 'frozenset([', '])',
+ return self._repr_iterable(x, level, 'frozenset({', '})',
self.maxfrozenset)
def repr_deque(self, x, level):