Skip to main content

function

Dunder methods

Dunder MethodOperationExample (normal syntax)Example (dunder call)
__call__Call the functionf(3)f.__call__(3)
__name__Function namef.__name__'f'(attribute access)
__defaults__Default argsf.__defaults__(attribute access)
__code__Bytecode infof.__code__.co_varnames(attribute access)
__annotations__Type hintsf.__annotations__(attribute access)
__doc__Docstringf.__doc__(attribute access)