views:

257

answers:

5

Could someone please give me a complete list of those special methods that you can put in classes, e.g. a couple are __len__ and __add__, but what are the rest? Thanks.

+12  A: 

Please take a look at the special method names section in the Python language reference.

Martin Geisler
Python's official documentation is excellent.
Fragsworth
+3  A: 

Here is a complete reference of all the Python magic methods.

e-satis
+5  A: 

Dive Into Python has an excellent appendix for them.

insin
+2  A: 

See Python Quick reference

Elazar Leibovich
A: 

Familiarize yourself with the dir function.

Absolute0
but that would only do what I wanted if a the class passed to it implemented all of the special methods.
Mk12