Recursive method

Hans Nowak ivnowa at hvision.nl
Wed Jul 14 05:03:11 EDT 1999


On 14 Jul 99, Ralph Gauges wrote:

> Hans Nowak wrote: 
> > You have a nested function here. (I say function, because it does not
> > look like a method... it's missing the self argument!
> 
> Actualy it is a method, but JPython doesn't seem to have a
> self. I was missing that as well.

Hmm... I didn't know that... I always assumed that programs for 
regular Python and JPython would be compatible...?

> > So, to solve this, you could try a different approach... maybe
> > 
> > (you said it's a method, right?)
> > 
> > class Blahblah:
> >     ...
> >     def makeTree(self):
> >          ....
> >     def makenodes(self, C):
> >          ....
> 
> I tried that as well, but I got the same error message. Only
> after I moved the makenodes outside the class it worked.
> This might also be related to the missing 'self' in JPython
> since I can not call 'self.makenodes'.
> Since moving makenodes out of the class is actualy not what
> I want, I was wondering, if anybody has had a similar
> problem and found a solution.

I see the problem... not the solution, though, because I don't know 
much (anything, actually) about JPython. :^( I wonder, if JPython 
doesn't have 'self', how can you call another method from within a 
method? Things like this

def method1(self, a):
    self.methodb(a+1)

would not be possible. There must be a way around this... (looks 
expectantly at JPython guru(s))

Hans Nowak (ivnowa at hvision.nl)
Homepage: http://fly.to/zephyrfalcon




More information about the Python-list mailing list