bool and unicode
Ronald Oussoren
oussoren at cistron.nl
Wed Aug 27 02:30:37 EDT 2003
On Tuesday, 26 August 2003, at 8:16, Roman Yakovenko wrote:
> Hi.
>
>>>> bool( u'True' )
> True
>>>> bool( u'False' )
> True
>>>>
>
> May somebody explain or give a reference to reason of such behaviour?
That has nothing to do with unicode, bool('False') is also True.
help(bool) says: Returns True when the argument x is true, False
otherwise. That is, x = bool(y) is the same as:
if y:
x = True
else:
x = False
Ronald
More information about the Python-list
mailing list