(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/16/ref/customization.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/16/ref/datamodel.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/16/ref/types.html| ]]
|
Python Reference Manual
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/16/ref/contents.html| ]]
|
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/16/ref/genindex.html| ]]
|
Next: 3.3.1 Basic customization Up: 3. Data model Previous: 3.2 The standard type
3.3 Special method names
A class can implement certain operations that are invoked by special syntax (such as arithmetic operations or subscripting and slicing) by defining methods with special names. For instance, if a class defines a method named __getitem__(), and x is an instance of this class, then x[i] is equivalent to x.__getitem__(i). (The reverse is not true -- if x is a list object, x.__getitem__(i) is not equivalent to x[i].) Except where mentioned, attempts to execute an operation raise an exception when no appropriate method is defined.
Subsections
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/16/ref/customization.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/16/ref/datamodel.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/16/ref/types.html| ]]
|
Python Reference Manual
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/16/ref/contents.html| ]]
|
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/16/ref/genindex.html| ]]
|
Next: 3.3.1 Basic customization Up: 3. Data model Previous: 3.2 The standard type