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

Chris Angelico rosuav at gmail.com
Wed Aug 31 21:47:28 EDT 2011


On Thu, Sep 1, 2011 at 10:48 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Python classes have a lot of dynamism made possible by the fact that methods
> are just wrappers around functions with an explicitly declared "self". That
> dynamism is rarely used, but not *that* rarely, and is very useful when
> used. Implicit self would likely negate all that.
>

Hmm. Got any examples sitting around? I'm curious as to what you can
do with this. I'm like a kid with a new chemistry set - "what happens
if I mix a little of everything together?"...

ChrisA



More information about the Python-list mailing list