Proposed PEP for a Conditional Expression
thp at cs.ucr.edu
thp at cs.ucr.edu
Thu Sep 20 19:25:42 EDT 2001
James_Althoff at i2.com wrote:
: Tom Payne wrote:
:>To me,
:>
:> count = 1 if by_land() else
:> 2 if by_sea() else
:> 0
:>
:>is clearer than
:>
:> if by_land():
:> count = 1
:> elif by_sea():
:> count = 2
:> else:
:> count = 0
: On the other hand, it's hard to make the case that the latter is *unclear*.
: And it's already there, just waiting to be used. ;-)
But it's not an expression.
Tom Payne
More information about the Python-list
mailing list