question about class, functions and scope

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sat Aug 26 13:32:53 EDT 2006


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




More information about the Python-list mailing list