I wonder if there exists a full list of the available magic (dunder) methods in Python? I searched online and on Python's website and got no such a list.
I also wonder can user define new magic (dunder) methods in Python? I understand I can define methods with underscores in their names, for example, __hello__()
. But I wonder how can I assign special functionalities (such as __add__()
is called with operator +
) for those user-defined magic methods? Say how do I ask python objects to automatically call __hello__()
method when they are used with operator $$
(a random example)?