[Tutor] when to use "self."
Deirdre Saoirse Moen
deirdre@deirdre.net
Mon, 2 Jul 2001 09:15:33 -0700
At 5:18 PM +0200 7/2/01, Brendon wrote:
>perhaps i'm just confused. when defining a class and giving it some widgets,
>methods (hum, why not just call them functions?.. grr)
To prevent confusion. A function can be called by anyone. A method is
a function specific to a class and can be called only in the context
of that class.
Think of the class variables as "things it has" and the methods as
"things it does."
>and data they all need
>to be perceded by 'self.' with exception of methods (only a call to one) and
>variables used internally, non?
Yes.
--
_Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net
"Cannot run out of time.... Is infinite time. You... are finite....
Zathrus... is finite. This... is wrong tool!" -- Zathrus