bool behavior in Python 3000?

Paul Rubin http
Wed Jul 11 01:56:36 CEST 2007


Steven Bethard <steven.bethard at gmail.com> writes:
> So it seems like you're really arguing for raising exceptions in all
> these situations. That would actually be fine with me since I never
> use bools as ints, but I suspect getting it past python-dev will be an
> uphill battle since it will break large chunks of code.

We had a huge discussion of this stuff when bools were introduced
in Python 2.3 or thereabouts.  The current system is about the
best way that doesn't break everything in sight.  The weirdness
is basically a consequence of bools being an afterthought in Python.
Python has a long tradition of implicitly casting other values to
bool, e.g. strings, lists, sets etc. are all false if empty, etc.



More information about the Python-list mailing list