AJ Ostergaard schrieb:
Hi Ralf,

Thanks for that but why:

 >>> '' and True
''

Surely that should be False?!?

No. Please read the section in the language reference about the and/or operators.

"and" will return the first false value, or the right side. Thus

'' and True -> ''

True and '' -> ''

'a' and True -> True

True and 'a' -> 'a'

"or" does the same, obviously with the or-semantics:


'' or False -> False
False or '' -> ''
'' or True -> True
True or '' -> True
'a' or False -> 'a'
False or 'a' -> 'a'

Diez

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to