[Python-Dev] conditional expressions? (original) (raw)

Skip Montanaro skip@pobox.com (Skip Montanaro)
Mon, 15 Oct 2001 13:46:44 -0500


Tim> [Skip Montanaro]
>> Is the thread in c.l.py on conditional expressions leading in the
>> direction of actually getting added to the language, or wer Tim's
>> experiments done just to show it's possible?

Tim> We (PythonLabs) were wondering whether to reserve any more keywords
Tim> for 2.2.  "then" was a natural candidate, for this specific use.
Tim> Guido and I have been playing with it.  If it proves to be a
Tim> low-hassle, low-impact change that works well, the intent is to get
Tim> it in for 2.2b1 later this week.  Doesn't look *likely* to me at
Tim> this point, but don't know.

Regardless whether or not you think this could make it into 2.2b1, I hope if you proceed it will get a PEP a reasonable amount of time before the CVS checkin... <0.1 wink>.

It seems downright weird to me that the syntactic baggage necessary to write a conditional expression is greater the the baggage necessary to write an if statement (new "then" keyword, parens required for disambiguation). The parens function pretty much as "{...}" in C, Java, Perl, etc. It's a step away from indentation-based block structure and toward delimiter-based block structure. If you add it, I think it will be harder to justify the lack of delimiter-based block stucture at the statement level. It will just be one more argument in the arsenal of people whose knee-jerk reaction to Python's block structure is to whine about it.

Skip