confused about self, why not a reserved word?

dcoffin at gmail.com dcoffin at gmail.com
Mon May 5 10:14:48 EDT 2008


> the class-thing seems inside out somehow in python. if im doing
> foo.Hello() im already saying that im using the class foo because i
> did foo=Foo() before and then still when calling Hello() i am
> invisibly passing the class itself a s a parameter by default?
> just seems backwards and weird.

You're not passing a reference to the class, you're passing a
reference to the object. Any object-orientated programming language
will be passing methods references to an object; Python just makes
that explicit within the method definition. See http://www.python.org/doc/faq/general/#id35



More information about the Python-list mailing list