A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2018-July/154364.html below:

[Python-Dev] Assignment expression and coding style: the while True case

[Python-Dev] Assignment expression and coding style: the while True case [Python-Dev] Assignment expression and coding style: the while True caseSerhiy Storchaka storchaka at gmail.com
Thu Jul 5 02:23:34 EDT 2018
05.07.18 01:51, Victor Stinner пише:
> == Pattern 1, straighforward ==
> 
> while True:
>      line = input.readline()
>      if not line:
>          break
>      ...
> 
> IMHO here assingment expression is appropriate here. The code remains
> straighfoward to read.
> 
> while (line := input.readline()):
>      ...

We already have an idiom for this:

for line in input:
     ...

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4