[Python-Dev] Re: ANN: PEP 335: Overloadable Boolean Operators

Tim Hochberg tim.hochberg at cox.net
Mon Sep 13 17:05:29 CEST 2004


Shane Holloway (IEEE) wrote:

> Tim Hochberg wrote:
> > that there are no use
> > cases for the custom short circuiting yet, we then just drop scand/scor
> > until a compelling use case shows up, if it ever does.
>
> A boolean calculus (predicate) engine would make use of 
> short-circuiting.  Or perhaps a state machine would make use of this 
> feature.  I agree with Greg that I'd rather the implementation be 
> "complete".  Computer Scientists have already been down this road, and 
> we know that there are two useful forms.  :)

I have no objections if someone can actually come up with use cases. 
However, I still thinks the names should change: and2/or2 will be used 
the vast majority of the time. Of course, my earlier suggestion to use 
and/or is completely bogus since that's what &/| map to. Doh!

Still, I think the use cases need to be more concrete than what we've 
seen so far. I can come up with a case where short circuiting could be 
used in numarray, but not one where I think it should, so I won't be of 
any help here.

>
> I like [__and1__, __and__, __or__, __or1__] -- the abbreviation would 
> have to be documented anyway, and the '1' says "one argument: self" to 
> me.


Sadly, and/or are already taken. I don't think this helps the and1/and2 
case much though -- having three methods and/and1/and2 is just 
confusing. Maybe booland or logand or logicaland? I dunno, none of those 
are particularly satisfying.

Regards,

-tim




More information about the Python-Dev mailing list