Confusion with calling function of a subclass
Pyenos
pyenos at pyenos.org
Fri Dec 22 03:13:18 EST 2006
Adonis Vargas <adonis at REMOVETHISearthlink.net> writes:
> 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.
>
> You first need to create an instance of the class:
>
> tree = TREE()
> tree.gettree()
>
> or
>
> TREE().gettree()
>
> Hope this helps.
>
> Adonis
>
> P.S. You should look into the tutorial
> http://docs.python.org/tut/tut.html it will answer a lot of your
> questions.
Yes, it definitely solved my problem. Thank you very much. :D
More information about the Python-list
mailing list