[Python-Dev] Assignment expression and coding style: the while True case
Serhiy Storchaka
storchaka at gmail.com
Thu Jul 5 02:30:25 EDT 2018
05.07.18 03:03, Victor Stinner пише:
> + labels = [slabel for label
> + in self._file.readline()[1:].split(b',')
> + if (slabel := label.strip())]
labels = [slabel for label
in self._file.readline()[1:].split(b',')
for slabel in [label.strip()]
if slabel]
> + lines = [match.group(1, 2)
> + for raw_line in raw_lines
> + if (match := line_pat.search(raw_line.strip()))]
lines = [match.group(1, 2)
for raw_line in raw_lines
for match in [line_pat.search(raw_line.strip())]
if match]
But in all these cases I prefer the original loop.
More information about the Python-Dev
mailing list