bool and unicode
Erik Max Francis
max at alcyone.com
Tue Aug 26 03:12:09 EDT 2003
Roman Yakovenko wrote:
> Hi.
>
> >>> bool( u'True' )
> True
> >>> bool( u'False' )
> True
> >>>
>
> May somebody explain or give a reference to reason of such behaviour?
Does this give you a hint?
>>> bool('True')
True
>>> bool('False')
True
>>> bool('')
False
The only string, Unicode or not, considered to be false is the null
string. All other strings are true, even if they spell the word
_false_.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ Procrastination is the thief of time.
\__/ Edward Young
More information about the Python-list
mailing list