# Python : Core : Special Methods *aka "Magic Methods"* * [reference/datamodel.html#special-method-names](https://docs.python.org/3/reference/datamodel.html#special-method-names) #### Directory - `__abs__` — ? - `__add__` — ? - `__aiter__` — ? - `__and__` — ? - `__anext__` — ? - `__await__` — ? - `__bool__` — ? - `__buffer__` — ? - `__call__` — ? - `__ceil__` — ? - `__class_getitem__` — ? - `__complex__` — ? - `__contains__` — ? - `__del__` — ? - `__delattr__` — ? - `__delete__` — ? - `__delitem__` — ? - `__dir__` — ? - `__divmod__` — ? - `__enter__` — ? - `__eq__` — ? - `__exit__` — ? - `__float__` — ? - `__floor__` — ? - `__floordiv__` — ? - `__format__` — ? - `__get__` — ? - `__getattr__` — ? - `__getattribute__` — ? - `__getitem__` — ? - `__ge__` — ? - `__gt__` — ? - `__hash__` — ? - `__iadd__` — ? - `__iand__` — ? - `__ifloordiv__` — ? - `__ilshift__` — ? - `__imatmul__` — ? - `__imod__` — ? - `__imul__` — ? - `__index__` — ? - `__init__` — ? - `__init_subclass__` — ? - `__instancecheck__` — ? - `__int__` — ? - `__invert__` — ? - `__ior__` — ? - `__ipow__` — ? - `__irshift__` — ? - `__isub__` — ? - `__iter__` — ? - `__itruediv__` — ? - `__ixor__` — ? - `__le__` — ? - `__len__` — ? - `__lshift__` — ? - `__lt__` — ? - `__match_args__` — ? - `__matmul__` — ? - `__missing__` — ? - `__mod__` — ? - `__mro_entries__` — ? - `__mul__` — ? - `__ne__` — ? - `__neg__` — ? - `__new__` — ? - `__or__` — ? - `__pos__` — ? - `__pow__` — ? - `__radd__` — ? - `__rand__` — ? - `__rdivmod__` — ? - `__release_buffer__` — ? - `__repr__` — ? - `__reversed__` — ? - `__rfloordiv__` — ? - `__rlshift__` — ? - `__rmatmul__` — ? - `__rmod__` — ? - `__rmul__` — ? - `__ror__` — ? - `__round__` — ? - `__rpow__` — ? - `__rrshift__` — ? - `__rshift__` — ? - `__rsub__` — ? - `__rtruediv__` — ? - `__rxor__` — ? - `__set__` — ? - `__set_name__` — ? - `__setattr__` — ? - `__setitem__` — ? - `__str__` — ? - `__sub__` — ? - `__subclasscheck__` — ? - `__truediv__` — ? - `__trunk__` — ? - `__xor__` — ? #### Context Managers ```python with <exp> as <var>: # `as <var>` is optional ... ``` ###### `__enter__( self )` The return value will be bound to the target(s) specified in the `as` clause, if any. ###### `__exit__( self, exc_type, exc_value, traceback )` If the context was exited without an exception, all three arguments will be None. If there's an exception, don't re-raise it — that's the caller's responsibility. To suppress propagation, return True.