calling a class instance of function

Gabriel Genellina gagsl-py at yahoo.com.ar
Wed Dec 20 22:55:34 EST 2006


On 20 dic, 21:09, Pyenos <pye... at pyenos.org> wrote:
> class pid:
>     "pid"
>     def add(original_pid,toadd):
>         "add pid"
>         original_pid.append(toadd)
>         return original_pid
For a method, you have to include an *explicit* first parameter
(usually called "self") that refers to the instance on which you call
the method (like "this" on other languages, but you have to be explicit
in Python).
Read the Python tutorial: http://docs.python.org/tut/

-- 
Gabriel Genellina




More information about the Python-list mailing list