On Thu, Apr 7, 2016, 7:51 AM Charles T. Smith <cts.private.ya...@gmail.com> wrote:
> On Wed, 06 Apr 2016 20:28:47 +0000, Rob Gaddi wrote: > > > 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. > > > Well, I probably stumbled astray due to my own stupidity, can't blame > anybody > of having misled me... ;) > > So it's a bug in my program! Good news! Thank you. > I'm guessing you are passing a list or dict to the recursive call and discovering that the object is passed rather than a copy. Note that this is not pass-by-reference, but "pass by object", for your Googling. > -- https://mail.python.org/mailman/listinfo/python-list