Newbie: Classes

KefX keflimarcusx at aol.comNOSPAM
Sun Oct 26 22:54:32 EST 2003


>If I remember correctly Java also passes 'this' into funtions but its 
>done implicitly.  Its there but you just don't see it.

Exactly, but it may or may not do it exactly the same way it does parameters;
in Java it's an implementation detail, whereas in Python it's part of all of
the methods' interfaces. So that's why I didn't say it gets "passed in", but in
a sense, it is.

It should be noted that ALL of the methods of a class should have the 'self'
parameter, or else you can't do instance.method(), only classname.method(), and
I don't think you really gain from this arbitrary restriction.

- Kef




More information about the Python-list mailing list