Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Use assign expr in list comprehension #8098

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -1341,9 +1341,9 @@ def _generate_toc(self):
if len(stops) < len(starts):
stops.append(line_pos - len(linesep))
starts.append(next_pos)
labels = [label.strip() for label
in self._file.readline()[1:].split(b',')
if label.strip()]
labels = [slabel for label
in self._file.readline()[1:].split(b',')
if (slabel := label.strip())]

This comment has been minimized.

Copy link
@JimJJewett

JimJJewett Jul 6, 2018

This is a counter-example to the "real programmers won't repeat stuff stuff today; they'll just move it to another line, which isn't that hard." (That said, I hope label.strip() is a relatively cheap operation, and that the second invocation will end up re-using the same location, so there won't be much memory churn.)

label_lists.append(labels)
elif line == b'\037' or line == b'\037' + linesep:
if len(stops) < len(starts):
@@ -843,11 +843,9 @@ def xgtitle(self, group, *, file=None):
DeprecationWarning, 2)
line_pat = re.compile('^([^ \t]+)[ \t]+(.*)$')
resp, raw_lines = self._longcmdstring('XGTITLE ' + group, file)
lines = []
for raw_line in raw_lines:
match = line_pat.search(raw_line.strip())
if match:
lines.append(match.group(1, 2))
lines = [match.group(1, 2)
for raw_line in raw_lines
if (match := line_pat.search(raw_line.strip()))]
return resp, lines

def xpath(self, id):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.