[Tutor] __and_ and and_

Yanko, Curtis (GSP) YankoC@gspinc.com
Mon, 18 Oct 1999 13:42:06 -0400


Huh? Isn't there an example very similar to this in PP? It uses 'Unions' and
'Intersects' but overrides __and__ and __or__ on pages 31-32.

-Curt

> -----Original Message-----
> From:	David Ascher [SMTP:da@ski.org]
> Sent:	Monday, October 18, 1999 1:26 PM
> To:	Joseph J. Strout
> Cc:	Arne Mueller; tutor
> Subject:	Re: [Tutor] __and_ and and_
> 
> 
> > 
> > >Why doesn't the 'in-operator' '__and__' behave the same way as 'and_'?
> > 
> > Because __and__ is the special method for overriding '&' (bitwise 
> > and), not 'and' (Boolean and).  You didn't override the latter, so it 
> > does what it normally does -- if both arguments are true, it returns 
> > the first one.
> > 
> > I don't see a way to override the 'and' or 'or' operators... you 
> > might be stuck using & and | instead.  Anybody have a better idea?
> 
> There is no way to override and or or or not.  
> 
> --david
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor