Difference between revisions of "Python double under (dunder) methods"
Jump to navigation
Jump to search
(4 intermediate revisions by one other user not shown) | |||
Line 11: | Line 11: | ||
__[[contains]]__ | __[[contains]]__ | ||
__[[repr]]__ | __[[repr]]__ | ||
+ | __[[name]]__ | ||
+ | __[[main]]__ | ||
== Related == | == Related == | ||
* [[Methods]] | * [[Methods]] | ||
* [[Classes]] | * [[Classes]] | ||
+ | * [[List]] | ||
* [[Double underscore]] | * [[Double underscore]] | ||
* [[Class methods]] | * [[Class methods]] | ||
Line 22: | Line 25: | ||
* <code>[[from]] os [[import]] open as open_</code> | * <code>[[from]] os [[import]] open as open_</code> | ||
* [[Underscore]] | * [[Underscore]] | ||
− | * [[if __name__ == "__main__":]] | + | * <code>[[if __name__ == "__main__":]]</code> |
== Activities == | == Activities == | ||
* http://python-history.blogspot.com/2009/02/adding-support-for-user-defined-classes.html | * http://python-history.blogspot.com/2009/02/adding-support-for-user-defined-classes.html | ||
− | * https://stackoverflow.com/questions/1436703/what-is-the-difference-between-str-and-repr | + | * [[Stackoverflow]]: [https://stackoverflow.com/questions/1436703/what-is-the-difference-between-str-and-repr What is the difference between __str__ and __repr__?] |
== See also == | == See also == |
Latest revision as of 15:04, 15 April 2023
Dunder stands for "double + under" methods
__init__ __str__ __call__ __setitem__ __getitem__ __delitem__ __len__ __add__ __contains__ __repr__ __name__ __main__
Related[edit]
- Methods
- Classes
- List
- Double underscore
- Class methods
- Python, C
- Polymorphism
_xxxx
and__xxxx
. Read https://docs.python.org/3/tutorial/classes.html#private-variablesfrom os import open as open_
- Underscore
if __name__ == "__main__":
Activities[edit]
- http://python-history.blogspot.com/2009/02/adding-support-for-user-defined-classes.html
- Stackoverflow: What is the difference between __str__ and __repr__?
See also[edit]
- Python, PIP, GIL, Flask, Django, Marshmallow,
def
, logging, Pandas, Numpy, AWS Chalice,import
,from
,tuple
,list
, Python exceptions,virtualenv
,.append
,pytz
,TZ
,print
,python3 -c
,os
, PEP, Python Institute, Methods: Dunder methods, Flake8, Python collections, Function decorators in Python, Click python library, Python module, Flower,kwargs
, Black (Python), Python list structure, Mypy,variables
, Casting,try:
, pydoc, argparse, Anaconda,pyenv, setup.py, python3 --version, python3 --help
, Data Classes, raise
Advertising: