Name

__and__, __lshift__, __or__, __rshift__, __xor__

Synopsis

__and__(self,other)
__lshift__(self,other)
__or__(self,other)
__rshift__(self,other)
__xor__(self,other)

Operators x & y, x << y, x | y, x >> y, and x ^ y, respectively, call these methods.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.