Newbie: Classes
KefX
keflimarcusx at aol.comNOSPAM
Sun Oct 26 21:48:19 EST 2003
All methods have 'self' as the first parameter. The actual name is unimportant,
but out of convention, practically everybody who's anybody uses 'self'.
What it is is an instance of a class. In C++ and Java, the same concept is
expressed with the 'this' keyword; Python just makes it explicit in having it
passed into the function.
So if I do this:
foobar = MyClass()
foobar.baz(2)
It is the same as:
foobar = MyClass()
MyClass.baz(foobar, 2)
Get it?
- Kef
More information about the Python-list
mailing list