bpo-30296: Partially revert #1489.#2624
Conversation
|
@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @zestyping, @pitrou and @loewis to be potential reviewers. |
| if self._addresses is None: | ||
| self._addresses = tuple(address for group in self._groups | ||
| for address in group.addresses) | ||
| self._addresses = tuple([address for group in self._groups |
There was a problem hiding this comment.
The list comprehension is not necessary and doesn't improve the code. This should stay as-is.
There was a problem hiding this comment.
The generator expression is slower. If you are fine with tiny performance regression introduced by the previous change I'll keep it.
| mro = getmro(cls) | ||
| metamro = getmro(type(cls)) # for attributes stored in the metaclass | ||
| metamro = tuple(cls for cls in metamro if cls not in (type, object)) | ||
| metamro = tuple([cls for cls in metamro if cls not in (type, object)]) |
There was a problem hiding this comment.
The list comprehension is not necessary and doesn't improve the code. This should stay as-is.
| props = config.pop('.', None) | ||
| # Check for valid identifiers | ||
| kwargs = dict((k, config[k]) for k in config if valid_ident(k)) | ||
| kwargs = {k: config[k] for k in config if valid_ident(k)} |
There was a problem hiding this comment.
This is an improvement. Go ahead.
| factory = klass | ||
| props = config.pop('.', None) | ||
| kwargs = dict((k, config[k]) for k in config if valid_ident(k)) | ||
| kwargs = {k: config[k] for k in config if valid_ident(k)} |
There was a problem hiding this comment.
This is an improvement. Go ahead.
|
|
||
| drive_letters = set('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') | ||
| drive_letters = set('abcdefghijklmnopqrstuvwxyz' | ||
| 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') |
There was a problem hiding this comment.
This change is unnecessary and not an improvement. Please leave as-is.
Adding a multi-line statement with implicit string concatenation doesn't make the code simpler.
There was a problem hiding this comment.
This line is too long and don't conform PEP 8.
| 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]) |
There was a problem hiding this comment.
The list comprehension is not necessary and doesn't improve the code. This should stay as-is.
| 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]) |
There was a problem hiding this comment.
The list comprehension is not necessary and doesn't improve the code. This should stay as-is.
|
|
||
| with open("%s.py" % filename,"w") as f: | ||
| keys = sorted(x for x in docsdict.keys() | ||
| keys = sorted(x for x in docsdict |
There was a problem hiding this comment.
This is an improvement. Go ahead.
|
|
||
| headers = dict(req.unredirected_hdrs) | ||
| headers.update((k, v) for k, v in req.headers.items() if k not in headers) | ||
| headers.update({k: v for k, v in req.headers.items() |
There was a problem hiding this comment.
Please leave as-is. Don't create an unnecessary intermediate dictionary.
There was a problem hiding this comment.
I afraid that this change changed semantic.
| result = tuple(PyObjectPtr.from_pyobject_ptr(self[i]).proxyval(visited) | ||
| for i in safe_range(int_from_int(self.field('ob_size')))) | ||
| result = tuple([PyObjectPtr.from_pyobject_ptr(self[i]).proxyval(visited) | ||
| for i in safe_range(int_from_int(self.field('ob_size')))]) |
There was a problem hiding this comment.
The list comprehension is not necessary and doesn't improve the code. This should stay as-is.
|
When you're done making the requested changes, leave the comment: |
|
Thank you for your review @rhettinger. Note that this PR mainly just reverts unnecessary changes that may have unwanted effects. |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7. |
|
GH-5908 is a backport of this pull request to the 3.7 branch. |
…ments. (pythonGH-2624) (cherry picked from commit 3f2e6f1) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
https://bugs.python.org/issue30296