bool behavior in Python 3000?
Steven Bethard
steven.bethard at gmail.com
Tue Jul 10 15:13:38 EDT 2007
Alan G Isaac wrote:
> > Do you care to explain what is broken?
>
> I suppose one either finds coercion of arithmetic operations to int
> to be odd/broken or does not. But that's all I meant.
>
> My preference would be for the arithmetic operations *,+,-
> to be given the standard interpretation for a two element
> boolean algebra:
> http://en.wikipedia.org/wiki/Two-element_Boolean_algebra
If I understand this right, the biggest difference from the current
implementation would be that::
True + True == True
instead of:
True + True == 2
What's the advantage of that? Could you give some use cases where that
would be more useful than the current behavior?
It's much easier to explain to newcomers that *, + and - work on True
and False as if they were 1 and 0 than it is to introduce them to a two
element boolean algebra. So making this kind of change needs a pretty
strong motivation from real-world code.
Steve
More information about the Python-list
mailing list