Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Lib/mailbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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):
Expand Down
8 changes: 3 additions & 5 deletions Lib/nntplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down