Confusion with calling function of a subclass

Fredrik Lundh fredrik at pythonware.com
Fri Dec 22 03:02:45 EST 2006


Pyenos wrote:

> class TREE:
>     def gettree(self):print self
> TREE.gettree() # I get an error saying 
>                # TypeError: unbound method gettree() must be called
>                # with TREE instance as first argument (got nothing instead
 >
> I still don't understand how to solve this simple code. 

what is it supposed to do?  what do you expect "self" to be, and where 
do you expect it to come from ?  have you tried adding some expletives, 
to see if that solves the problem ?

</F>




More information about the Python-list mailing list