question about class, functions and scope

nephish nephish at gmail.com
Sat Aug 26 14:09:13 EDT 2006


bearophileHUGS at lycos.com wrote:
> nephish:
> > one more question.
> > the functions defined above the classes that the could be called from
> > within the classes, they do not need a 'self' declaration because they
> > are not part of a class, right?
>
> Class methods generally require the self as first parameter, functions
> don't need the self. So your original code was wrong (sorry, I haven't
> seen that before).
>
> You can also inject functions as methods inside a class, and in such
> case your function usually needs a self parameter too.
>
> Bye,
> bearophile

ok, thanks much, thats all i needed to know.
shawn




More information about the Python-list mailing list