"self" - a python wart or "feature"

Cere Davis ceremona2000 at yahoo.com
Sun Feb 16 23:04:20 EST 2003


Hi Pythoners,

I don't understand why Python requires "self" as the first argument in
every function that intends to act on a instance of a given class eg:

class C:
    def stuff(self,x):
        print x


isn't it enough to assume that all function indented under class C
will be acting on an instance of the object C unless they are
specifily declared as staticmethods, etc?  Why bother requiring the
self keyword in every stinkin' method?  This seems klunky to me but
perhaps there is something I am missing here.

Thanks in advance,
Cere




More information about the Python-list mailing list