[Python-ideas] "Assignment expression" with function call-alike syntax

Mike Miller python-ideas at mgmiller.net
Wed May 23 10:54:28 EDT 2018


On 2018-05-22 14:32, Kirill Balunov wrote:
>     # in global scope everything works ok since locals is globals
>      >>> while len( this( val = dummy() ) ) >= 0:
>     ...     print(val)
>     [0, 1]
>     [0, 1, 2]
>     [0, 1, 2, 3]

Interesting!  Although the example with a len() and mutable default arguments 
obscured the utility, I thought.  Also, why limit it to one assignment?

Liked Terry's suggestions for name.  The name that jumped into my brain as I 
read was a reuse of the locals() or globals() callable with key words, that 
would change their behavior to what you suggest.

-Mike


More information about the Python-ideas mailing list