bool and unicode
romany at actimize.com
Tue Aug 26 10:30:55 CEST 2003
Thanks. I am going to sleep a little :-).
But still I expect this code to work.
assert False == bool( str( bool( False ) ) )
The context of previous expression is in serialization.
I save\read my data in\from XML file. So I expected this to work
without any additional afford from me. But I was wrong.
My mistake was exectly as you explain, thanks.
> -----Original Message-----
> From: Erik Max Francis [mailto:max at alcyone.com]
> Sent: Tuesday, August 26, 2003 9:12 AM
> To: python-list at python.org
> Subject: Re: bool and unicode
> Roman Yakovenko wrote:
> > Hi.
> > >>> bool( u'True' )
> > True
> > >>> bool( u'False' )
> > True
> > >>>
> > May somebody explain or give a reference to reason of such
> Does this give you a hint?
> >>> bool('True')
> >>> bool('False')
> >>> bool('')
> 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
> 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