Skip to content

bpo-30296: Partially revert #1489.#2624

Merged
serhiy-storchaka merged 3 commits into
python:masterfrom
serhiy-storchaka:revert-pr-1489
Feb 26, 2018
Merged

bpo-30296: Partially revert #1489.#2624
serhiy-storchaka merged 3 commits into
python:masterfrom
serhiy-storchaka:revert-pr-1489

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 7, 2017

Copy link
Copy Markdown
Member

@mention-bot

Copy link
Copy Markdown

@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.

Comment thread Lib/email/headerregistry.py Outdated
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list comprehension is not necessary and doesn't improve the code. This should stay as-is.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generator expression is slower. If you are fine with tiny performance regression introduced by the previous change I'll keep it.

Comment thread Lib/inspect.py Outdated
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)])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list comprehension is not necessary and doesn't improve the code. This should stay as-is.

Comment thread Lib/logging/config.py
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)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an improvement. Go ahead.

Comment thread Lib/logging/config.py
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)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an improvement. Go ahead.

Comment thread Lib/pathlib.py Outdated

drive_letters = set('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
drive_letters = set('abcdefghijklmnopqrstuvwxyz'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is too long and don't conform PEP 8.

Comment thread Lib/turtle.py Outdated
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])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list comprehension is not necessary and doesn't improve the code. This should stay as-is.

Comment thread Lib/turtle.py Outdated
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])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list comprehension is not necessary and doesn't improve the code. This should stay as-is.

Comment thread Lib/turtle.py

with open("%s.py" % filename,"w") as f:
keys = sorted(x for x in docsdict.keys()
keys = sorted(x for x in docsdict

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an improvement. Go ahead.

Comment thread Lib/urllib/request.py

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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave as-is. Don't create an unnecessary intermediate dictionary.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I afraid that this change changed semantic.

Comment thread Tools/gdb/libpython.py Outdated
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')))])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list comprehension is not necessary and doesn't improve the code. This should stay as-is.

@bedevere-bot

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@serhiy-storchaka

Copy link
Copy Markdown
Member Author

Thank you for your review @rhettinger. Note that this PR mainly just reverts unnecessary changes that may have unwanted effects.

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot

Copy link
Copy Markdown

GH-5908 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 26, 2018
…ments. (pythonGH-2624)

(cherry picked from commit 3f2e6f1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington added a commit that referenced this pull request Feb 26, 2018
…ments. (GH-2624)

(cherry picked from commit 3f2e6f1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants