[Python-Dev] bool conversion wart?

Neal Becker ndbecker2 at gmail.com
Fri Feb 23 02:13:06 CET 2007


Jonathan Lange wrote:

> On 2/23/07, Neal Becker <ndbecker2 at gmail.com> wrote:
>> >>> bool ('False')
>> True
>>
> 
> Non-empty strings are considered True, empty strings are considered
> False. This is not a wart, as the behaviour matches that of other
> sequences.
> 

Well consider this:
>>>str (4)
'4'
>>>int(str (4))
4
>>>str (False)
'False'

>>>bool(str(False))
True

Doesn't this seem a bit inconsisent?



More information about the Python-Dev mailing list