Op 29 nov. 2017 22:35 schreef "Greg Ewing" <greg.ew...@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@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to