bool behavior in Python 3000?

Nis Jørgensen nis at superlativ.dk
Thu Jul 12 14:31:46 CEST 2007


Alan Isaac skrev:
> Since it is seemingly ignored in most of the comments
> on this thread, I just want to remind that PEP 285
> http://www.python.org/dev/peps/pep-0285/
> says this:
> 
>       In an ideal world, bool might be better implemented as a
>       separate integer type that knows how to perform mixed-mode
>       arithmetic.
> 
> I mentioned Python 3000 since that is an opportunity for an ideal world.

You forgot to quote this bit:

    4) Should we strive to eliminate non-Boolean operations on bools
       in the future, through suitable warnings, so that for example
       True+1 would eventually (in Python 3000) be illegal?

    => No.

       There's a small but vocal minority that would prefer to see
       "textbook" bools that don't support arithmetic operations at
       all, but most reviewers agree with me that bools should always
       allow arithmetic operations.

Nis



More information about the Python-list mailing list