Proposed PEP for a Conditional Expression
sebastien
s.keim at laposte.net
Mon Sep 10 07:56:58 EDT 2001
More information about the Python-list mailing list
Mon Sep 10 07:56:58 EDT 2001
- Previous message (by thread): Proposed PEP for a Conditional Expression
- Next message (by thread): Proposed PEP for a Conditional Expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> SPEC_4: Use "if c: a else: b". > The following production would be added to Python syntax: > expression: "if" expression ":" expression "else" ":" > expression > The famous "dangling-else" problem would NOT arise because > the "else:" part would be mandatory. > > PRO - [might allow "if c1: a elif c2: b else: c"] > CON - [elif thing would re-introduce dangling else problem] If think that this option has a killer PRO argument: It's the syntax that anyone who already know the current if construct in python would try in first attempt. That's because this syntax is the only one which is coherent with the langage and don't introduce new concept but only extend an existing one. That's why I'm agree for conditionnal expression with this syntax but absolutly against the C ternary operator syntax. The over ones are even worst because they are subbtle fluctations of the python standard if construct and a potential source of confussion.
- Previous message (by thread): Proposed PEP for a Conditional Expression
- Next message (by thread): Proposed PEP for a Conditional Expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list