PEP-0315--Enhanced While Loop: An idea for an alternative syntax

Paul Rubin http
Wed Feb 18 01:49:36 EST 2004


Erik Max Francis <max at alcyone.com> writes:
> 	do:
> 	    line = inputFile.readline()
> 	while line:
> 	    ...
> 	    line = inputFile.readline()

So it's yet another workaround for Python's lack of assignment
expressions.  I like

    while (line := inputFile.readline()):
        ...

a lot better.



More information about the Python-list mailing list