Difference between revisions of "Python double under (dunder) methods"

From wikieduonline
Jump to navigation Jump to search
m (Welcome moved page Dunder methods to Python dunder methods)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
"double +‎ under" methods
+
Dunder stands for "double +‎ under" [[methods]]
  
 
  [[__init__]]
 
  [[__init__]]
Line 8: Line 8:
 
  __[[delitem]]__
 
  __[[delitem]]__
 
  __[[len]]__
 
  __[[len]]__
 +
__[[add]]__
 
  __[[contains]]__
 
  __[[contains]]__
 +
__[[repr]]__
 +
__[[name]]__
 +
__[[main]]__
  
 
== Related ==
 
== Related ==
 
* [[Methods]]
 
* [[Methods]]
 
* [[Classes]]
 
* [[Classes]]
 +
* [[List]]
 
* [[Double underscore]]
 
* [[Double underscore]]
 
* [[Class methods]]
 
* [[Class methods]]
Line 18: Line 23:
 
* [[Polymorphism]]
 
* [[Polymorphism]]
 
* <code>_xxxx</code> and <code>__xxxx</code>. Read https://docs.python.org/3/tutorial/classes.html#private-variables
 
* <code>_xxxx</code> and <code>__xxxx</code>. Read https://docs.python.org/3/tutorial/classes.html#private-variables
 +
* <code>[[from]] os [[import]] open as open_</code>
 +
* [[Underscore]]
 +
* <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
 +
* [[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

Advertising: