0 votes
in Python by

What are the Dunder/Magic/Special methods in Python? Name a few.

1 Answer

0 votes
by

Dunder (derived from double underscore) methods are special/magic predefined methods in Python, with names that start and end with a double underscore. There's nothing really magical about them. Examples of these include:

  • init - constructor
  • strrepr - object representation (casting to string, printing)
  • lennext... - generators
  • enterexit - context managers
  • eqltgt - operator overloading

Related questions

0 votes
asked Aug 30, 2020 in Python by sharadyadav1986
0 votes
asked Oct 3, 2021 in Linux by john ganales
...