In Python, special methods (also known as magic methods or dunder methods) are identified by double underscores (e.g., __init__, __str__, __add__). These methods allow you to define specific behaviors for your objects. Here's a list of some commonly used special methods:

  1. __init__(self, ...): Constructor method, used to initialize object attributes.
  2. __del__(self): Destructor method, used to clean up resources when an object is deleted.
  3. __str__(self): String representation of an object when using str(obj) or print(obj).
  4. __repr__(self): Developer-friendly representation of an object when using repr(obj).
  5. __len__(self): Defines the behavior when calling len(obj).
  6. __getitem__(self, key): Used to get an item using square brackets, e.g., obj[key].
  7. __setitem__(self, key, value): Used to set an item using square brackets, e.g., obj[key] = value.
  8. __delitem__(self, key): Used to delete an item using del obj[key].
  9. __iter__(self): Returns an iterator object to support iteration over the object.
  10. __next__(self): Used in conjunction with __iter__ to define the next iteration element.
  11. __contains__(self, item): Checks if an item is present in the object using item in obj.
  12. __call__(self, ...): Allows an object to be callable like a function, e.g., obj().
  13. __add__(self, other): Defines behavior for the addition operation +.
  14. __sub__(self, other): Defines behavior for the subtraction operation ``.
  15. __mul__(self, other): Defines behavior for the multiplication operation ``.
  16. __truediv__(self, other): Defines behavior for the division operation /.
  17. __floordiv__(self, other): Defines behavior for the floor division operation //.
  18. __mod__(self, other): Defines behavior for the modulo operation %.
  19. __pow__(self, other): Defines behavior for the power operation *.