[Tutor] __and_ and and_
Yanko, Curtis (GSP)
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.
> -----Original Message-----
> From: David Ascher [SMTP:email@example.com]
> 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.
> Tutor maillist - Tutor@python.org