A dict containing annotations of parameters. The keys of the dict are the parameter names, and 'return' for the return annotation, if provided. For more information on working with this attribute, see Annotations Best Practices.
None or a tuple of cells that contain bindings for the function’s free variables. See below for information on the cell_contents attribute.
The code object representing the compiled function body.
A tuple containing default argument values for those arguments that have defaults, or None if no arguments have a default value.
A reference to the dictionary that holds the function’s global variables — the global namespace of the module in which the function was defined.
A dict containing defaults for keyword-only parameters.
isinstance(y, x)
Defined for x's metaclass
issubclass(y, x), called for x if x is derived from ABC
__del__ is a finalizer. It is called when an object is garbage collected which happens at some point after all references to the object have been deleted.
Called for A when calling del A.x
Called for A when calling del A[n] or A[n:n] in which case a slice object is given as key
del X.y will call y's __delete__ (property)
X.y = Y(), X.y will call y's __get__ (property)
X.y = Y(), X.y = z will call y's __set__ (property)
module.__all__, decides what's exported by module
Returns a list of classes that X has directly inherited from
The namespace supporting arbitrary function attributes.
The function’s documentation string, or None if unavailable; not inherited by subclasses.
The name of the module the function was defined in, or None if unavailable.
The function’s qualified name.
sys.getsizeof(x), Internal size in bytes
Returns a list of classes that directly inherited X
list[x] calls x.__index__
len(x), also called by bool(x), guessing it's cause empty iterables should return False
Estimate of len if len(x) raises TypeError, defined in iterators
class X(dict) X()["missing"]
Only works for subclass of dict, called if key is missing
reversed(x), if not defined then len and getitem will be used
y & x, used if y hasn't implemented it or if that returns NotImplementedError
y | x, used if y hasn't implemented it or if that returns NotImplementedError
y ^ x, used if y hasn't implemented it or if that returns NotImplementedError
Called for attrs that aren't already defined.
Called unconditionally to implement attribute accesses for instances of the class.
y + x, used if y hasn't implemented it or if that returns NotImplementedError
y / x, used if y hasn't implemented it or if that returns NotImplementedError
divmod(y, x), used if y hasn't implemented it or if that returns NotImplementedError
y // x, used if y hasn't implemented it or if that returns NotImplementedError
y % x, used if y hasn't implemented it or if that returns NotImplementedError
y * x, used if y hasn't implemented it or if that returns NotImplementedError
pow(y, x), used if y hasn't implemented it or if that returns NotImplementedError
y - x, used if y hasn't implemented it or if that returns NotImplementedError
y / x, used if y hasn't implemented it or if that returns NotImplementedError
math.trunc(x), floors positive, ceils negative
y @ x, used if y hasn't implemented it or if that returns NotImplementedError
class Y(X):
called for X if something inherits it
Called before init to create object of class without parameters
Return namespace for metaclass
class Y: foo = X()
Called for X, attr has to be defined within class scope
return a tuple of how to call __new__ with pickle.loads(str), positional only
Like __getnewargs__ but key-word only
__dict__ is pickled if this isn't defined, otherwise return obj is pickled
Low level interface for pickling, alternative to __getstate__ and __setstate__. Takes no parameters
Takes presedence over __reduce__, takes one integer as parameter (the protocol number)
Returns new __dict__ for unpickled obj
"{0}".format(4) or format(X)