Empty string is False right?

AJ Ostergaard aj at cubbyhole.net
Sat Jan 31 12:35:05 CET 2009


Hello,

First post so bear with me if I'm being a numpty ...

Is it me or is there something slightly counter intuitive and thus not  
so pythonesque about this:

 >>> s = ''
 >>> if s: True
... else: False
...
False
 >>> s and eval(s)
''
 >>>

Regards,
AJ




More information about the Python-list mailing list