__or__
Dunder MethodPython 2.0+Advanced
Defines behavior for the | bitwise OR operator
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.0+
Learn by Difficulty
Quick Example
python
class Example: def __or__(self): return "Example __or__" obj = Example() print(obj)
__or__ defines behavior for the | bitwise or operator. Implementing it lets you customize how Python interacts with your objects.
Try in PlaygroundTags
oopmagic-methodprotocolcore