bool constructor is inconsistent?

Stefan Schwarzer sschwarzer at
Fri Sep 10 20:35:10 CEST 2010

Hi Neal,

On 2010-09-10 20:23, Neal Becker wrote:
> IN [3]: bool('False')
> Out[3]: True

If you consider strings, only an empty string has a false
value. So the string 'False' which is non-empty, results in
a true boolean value.

For example, you can use

    if my_string:

to execute some code if the string is not empty.


More information about the Python-list mailing list