Why do class methods always need 'self' as the first parameter?

Javier Collado javier.collado at gmail.com
Wed Aug 31 11:10:45 EDT 2011


Hello,

2011/8/31 T. Goodchild <tgoodchild at gmail.com>:
> But one of the things that bugs me is the requirement that all class
> methods have 'self' as their first parameter.  On a gut level, to me
> this seems to be at odds with Python’s dedication to simplicity.

I think the answer to this question is part of the zen of python:
<<Explicit is better than implicit.>>

http://www.python.org/dev/peps/pep-0020/

Regards,
    Javier



More information about the Python-list mailing list