PEP308 :
Mel Wilson
mwilson at the-wire.com
Fri Feb 14 11:05:07 EST 2003
In article <b2j27d$1cni8j$1 at ID-160218.news.dfncis.de>,
Roel Mathys <Roel.Mathys at yucom.be> wrote:
>Could this work?
>
>Ternary :
>
> if x : ( "it 's alright" , "Bye bye" )
>
>would be the same as :
>
> if x :
> "it 's alright"
> else :
> "Bye bye"
No, because it's not the same:
Python 2.1.3 (#35, Apr 8 2002, 17:47:50) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> x=1
>>> if x==1: ("It's alright", "Bye-bye")
...
("It's alright", 'Bye-bye')
>>>
Python is a simple yet powerful language. Well worth learning.
Regards. Mel.
More information about the Python-list
mailing list