Proto-PEP: Overloadable Boolean Operators
Tim Hochberg
tim.hochberg at ieee.org
Thu Sep 9 10:26:17 EDT 2004
Greg Ewing wrote:
> Andrew Durdin wrote:
>
>> I'm not at a machine with the patch installed on it at the moment, but
>> I just began to whether this patch would have an effect on expressions
>> like (a < b < c)
>
>
> No, it won't have any effect on those. I don't think
> it should, either -- it should only apply when you
> explicitly write an 'and'.
[I should probably download the patch and try this before commenting,
but no time, so: open mouth, insert foot].
Why? You specifically mention Numeric/Numarray as one motivating factor
for this patch, and as a long time Numeric/Numarray user I'd rather have
(a < b < c) work than (a and b).
My biggest concern is that if (a < b < c) is not changed in conjunction
with (a and b), the behaviour of the former becomes difficult to
explain. Currently one can explain it by saying, "a < b < c is
interpreted as (a < b) and (b < c), and 'and' doesn't work on numeric
arrays". However, if 'and' starts to work sensible for numarrays, but (a
< b < c) retains the old behaviour, the behaviour becomes both hard to
explain and hard to understand.
I'll try to download the patch and comment more completely later.
-tim
More information about the Python-list
mailing list