preference for 'x if c else y' over 'c then x else y'
Erik Max Francis
max at alcyone.com
Sat Feb 15 01:25:23 EST 2003
More information about the Python-list mailing list
Sat Feb 15 01:25:23 EST 2003
- Previous message (by thread): PEP308 - preference for 'x if c else y' over 'c then x else y'
- Next message (by thread): PEP308 - preference for 'x if c else y' over 'c then x else y'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Stephen Horne wrote: > The '... if ... else ...' version seems to have a natural > repetition-based pattern of growth which need not rely on obvious > nesting... > > x if c1 else y if c2 else z > > OK, yes, it is nesting really - but, like the C 'else if', it reads > more like a continuation of the same thing than a nesting of one thing > in another. I really don't follow. I would argue exactly the opposite: Since if/else doesn't read left-to-right, the use of it for nesting (they're nesting both ways, however you want to look at it) is _more_ strightforward on the strict left-to-right ordering of then/else than on the center-left-right one. In the center-left-right one, it is harder to tell which condition belongs to what expressions due to the out of order pattern. All I see here is, "X strikes me as better than Y" -- which don't get me wrong, is a perfectly valid opinion -- but I really don't see any clarification of why. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE / \ A man's life is what his thoughts make it. \__/ Marcus Aurelius Fauxident / http://www.alcyone.com/pyos/fauxident/ A "faux" ident daemon in Python.
- Previous message (by thread): PEP308 - preference for 'x if c else y' over 'c then x else y'
- Next message (by thread): PEP308 - preference for 'x if c else y' over 'c then x else y'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list