bool and unicode

Ronald Oussoren oussoren at
Wed Aug 27 08:30:37 CEST 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
		x = False


More information about the Python-list mailing list