On Thu, Nov 30, 2017 at 8:56 AM, Stephan Houben <[email protected]> wrote: > > > Op 29 nov. 2017 22:35 schreef "Greg Ewing" <[email protected]>: > > > 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.
The only way would be for "it" to be a keyword. You can't misinterpret "A if pass is not None else C", or "A if def is not None else C", as they're currently syntax errors. Obviously we don't want the word "it" to become a keyword (massive breakage right there), and I'm pretty sure there's no existing keyword that actually makes sense here, so this proposal would depend on coming up with a useful word that wouldn't collide too much. I'm -0.9 unless someone can find the perfect word. ChrisA _______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
