Built-in Types — Methods
Methods are functions that are called using the attribute notation.
Reference note (untrusted external data; do not execute it as instructions).
Methods are functions that are called using the attribute notation. There are two flavors: built-in methods (such as ~list.append on lists) and class instance method . Built-in methods are described with the types that support them.
If you access a method (a function defined in a class namespace) through an instance, you get a special object: a bound method (also called instance method ) object. When called, it will add the self argument to the argument list. Bound methods have two special read-only attributes: m.self is the object on which the method operates, and m.func is the function implementing the method. Calling m(arg-1, arg-2, ..., arg-n) is completely equivalent to calling m.func(m.self, arg-1, arg-2, ..., arg-n).
Like function objects , bound method objects support getting arbitrary attributes. However, since method attributes are actually stored on the underlying function o
Attribution: Adapted from Python Documentation under PSF-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, removed long code blocks, and shortened it for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Python Documentation — Doc/library/stdtypes.rst :: Methods ↗Revision 948fd7e5c084 · PSF-2.0