recursive methods require implementing a stack?

Rob Gaddi rgaddi at highlandtechnology.invalid
Wed Apr 6 16:28:47 EDT 2016


Charles T. Smith wrote:

> I just tried to write a recursive method in python - am I right that local
> variables are only lexically local scoped, so sub-instances have the same
> ones?  Is there a way out of that?  Do I have to push and pop my own simulated
> stack frame entry? 

You have been badly misled.  Python local variables are frame local, and
recursion just works.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.



More information about the Python-list mailing list