Jul-13-2018, 03:52 PM
(Jul-13-2018, 03:31 PM)DeaD_EyE Wrote: I understand him.
Thank you for your time. :-)
I read the PEP 572. My first reaction was that this looks like assignment in Pascal.
But as I saw the examples, I was impressed.
if pid := os.fork(): # Parent code else: # Child codeSo with this code, the return value ofos.fork()
is first assigned to the namepid
, then the if-statement will be executed withpid
.
Doing evaluation and branching with one line code is very handy.
I looked at the pep, and was surprised that GvR was in support of it. I was under the impression that the rule about assignment not possible in expressions was one of his original purposes in Python, as having too many things in one line can get convoluted quickly.