[Tutor] RE: __and__

Tim Peters tim_one@email.msn.com
Tue, 19 Oct 1999 20:03:42 -0400


[Arne Mueller]
> ...
> The problem is that and, or, not sounds more natural for my problem
> than +, - .

Overload

    &    def__and__(self, other): ...
    |    def __or__(self, other): ...
    ~    def __invert__(self): ...
    ^    def __xor__(self, other): ...

"and" and "or" are control structures in Python, not operators.  That's why
you can't overload them.

they-generate-branches-ly y'rs  - tim