diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2017-05-18 14:35:54 (GMT) |
---|---|---|
committer | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2017-05-18 14:35:54 (GMT) |
commit | 3972628de3d569c88451a2a176a1c94d8822b8a6 (patch) | |
tree | 30627d132c42fb65f96c3d9e209b317f68d175ed /Lib/turtle.py | |
parent | 906f5330b9c9a74cad1cf27fddaf77e99dff9edd (diff) | |
download | cpython-3972628de3d569c88451a2a176a1c94d8822b8a6.zip cpython-3972628de3d569c88451a2a176a1c94d8822b8a6.tar.gz cpython-3972628de3d569c88451a2a176a1c94d8822b8a6.tar.bz2 |
bpo-30296 Remove unnecessary tuples, lists, sets, and dicts (#1489)
* Replaced list(<generator expression>) with list comprehension
* Replaced dict(<generator expression>) with dict comprehension
* Replaced set(<list literal>) with set literal
* Replaced builtin func(<list comprehension>) with func(<generator
expression>) when supported (e.g. any(), all(), tuple(), min(), &
max())
Diffstat (limited to 'Lib/turtle.py')
-rw-r--r-- | Lib/turtle.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/turtle.py b/Lib/turtle.py index 8036b7f..b2623f1 100644 --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -1175,7 +1175,7 @@ class TurtleScreen(TurtleScreenBase): cl = [16*int(cstr[h], 16) for h in cstr[1:]] else: raise TurtleGraphicsError("bad colorstring: %s" % cstr) - return tuple([c * self._colormode/255 for c in cl]) + return tuple(c * self._colormode/255 for c in cl) def colormode(self, cmode=None): """Return the colormode or set it to 1.0 or 255. @@ -2989,7 +2989,7 @@ class RawTurtle(TPen, TNavigator): t11, t12, t21, t22 = l, 0, 0, l elif self._resizemode == "noresize": return polygon - return tuple([(t11*x + t12*y, t21*x + t22*y) for (x, y) in polygon]) + return tuple((t11*x + t12*y, t21*x + t22*y) for (x, y) in polygon) def _drawturtle(self): """Manages the correct rendering of the turtle with respect to @@ -3839,8 +3839,8 @@ def write_docstringdict(filename="turtle_docstringdict"): docsdict[key] = eval(key).__doc__ with open("%s.py" % filename,"w") as f: - keys = sorted([x for x in docsdict.keys() - if x.split('.')[1] not in _alias_list]) + keys = sorted(x for x in docsdict.keys() + if x.split('.')[1] not in _alias_list) f.write('docsdict = {\n\n') for key in keys[:-1]: f.write('%s :\n' % repr(key)) |