Defending the ternary operator
Paul Paterson
hamonlypaulpaterson at houston.rr.com
Mon Feb 10 02:35:31 EST 2003
More information about the Python-list mailing list
Mon Feb 10 02:35:31 EST 2003
- Previous message (by thread): Defending the ternary operator
- Next message (by thread): Defending the ternary operator
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Andrew Dalke" <adalke at mindspring.com> wrote in message news:b27ip8$d7c$1 at slb4.atl.mindspring.net... > Paul Paterson > > Continuing the experiment to look at Python code which might use the > > conditional operator.... > > > > If my regular expression is correct (and it probably isn't because I'm not > > good at them), then a quick scan of my Python22 directory structure finds > > 769 matches of the following pattern, > > > > if <something> > > variable = <some value> > > else: > > variable = <some other value> > > Oh yeah, and you should also check for > > if <something>: > return <some value> > return <some other value> > > Which is also more common in C code compared to > > return something ? some_value : some_other_value; > Wait, I thought that conditional expressions were supposed to reduce the cognitive overload and now here I am having to think up weird and wonderful regular expressions to try to evaluate the cognitive benefit... <wink>
- Previous message (by thread): Defending the ternary operator
- Next message (by thread): Defending the ternary operator
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list