Re: if-else statement

2009-01-11 Thread Aaron Brady
On Jan 10, 2:28 pm, bearophileh...@lycos.com wrote: > Scott David Daniels: > > >       if checking: > >           my_var = 'string' > >       else: > >           my_var = 'other string' > > > remember, vertical space only kills trees if printed. > > I value clarity a lot. But this is more DRY, some

Re: if-else statement

2009-01-10 Thread bearophileHUGS
Scott David Daniels: >       if checking: >           my_var = 'string' >       else: >           my_var = 'other string' > > remember, vertical space only kills trees if printed. I value clarity a lot. But this is more DRY, sometimes it's almost equally clear, and you reduce vertical space, packi

Re: if-else statement

2009-01-10 Thread Scott David Daniels
Duncan Booth wrote: Gandalf wrote: other languages ... [have an] if-else operator like... myVar = checking == 1? 'string': 'other string' See http://docs.python.org/reference/expressions.html#boolean-operations ... The expression x if C else y first evaluates C (not x); if C is true, x i

Re: if-else statement

2009-01-10 Thread Philip Semanchuk
On Jan 10, 2009, at 9:26 AM, Duncan Booth wrote: Gandalf wrote: other languages like PHP or javascript as this if-else operator like this myVar = checking == 1? 'string': 'other string' is this stuff exist in python? See http://docs.python.org/reference/expressions.html#boolean-operati

Re: if-else statement

2009-01-10 Thread Duncan Booth
Gandalf wrote: > other languages like PHP or javascript as this if-else operator like > this > > myVar = checking == 1? 'string': 'other string' > > is this stuff exist in python? > See http://docs.python.org/reference/expressions.html#boolean-operations conditional_expression ::= or_test