[Python-ideas] [Python-Dev] What's the status of PEP 505: None-aware operators?
Stephan Houben
stephanh42 at gmail.com
Wed Nov 29 16:56:08 EST 2017
Op 29 nov. 2017 22:35 schreef "Greg Ewing" <greg.ewing at canterbury.ac.nz>:
It would read better with some kind of pronoun in there:
A if it is not None else C
Hypercard's Hypertalk had a special variable "it" that
worked sort of like that.
I considered that, but there are two issues.
1. Backward-incompatible change
2. The semantics of
A if B else C
now depends on if B contains 'it',
in which case A gets evaluated unconditionally and prior to B.
What if evaluation of 'it' is itself conditional, e.g.
print("hello") if a or it else print("goodbye")
Note that in the
A if <binary_relation> B else C
proposal the evaluation of the implicit 'it' is never conditional in that
way.
Stephan
--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas at python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171129/ee233ccb/attachment-0001.html>
More information about the Python-ideas
mailing list