Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #106620
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Michael Selik <michael.selik@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: recursive methods require implementing a stack? |
| Date | Thu, 07 Apr 2016 07:25:56 +0000 |
| Lines | 31 |
| Message-ID | <mailman.4.1460013967.2253.python-list@python.org> (permalink) |
| References | <ne3r48$bk8$1@dont-email.me> <ne3rhv$e1e$1@dont-email.me> <ne4vo4$htk$1@dont-email.me> <CAGgTfkOHXCsyRsa2ea5difNVJQ6uQxULw2HE36aw6Sac3Yx6MQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de GmKXixl6wE8xonzQQ8uTSA3gudJKjB0EeDlTY6HyxmTQ== |
| Return-Path | <michael.selik@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'pop': 0.05; 'that?': 0.05; 'badly': 0.07; 'works.': 0.07; 'dict': 0.09; 'bug': 0.10; 'python': 0.10; 'stack': 0.13; 'wed,': 0.15; 'thu,': 0.15; 'variables': 0.15; '2016': 0.16; '7:51': 0.16; 'blame': 0.16; 'guessing': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'simulated': 0.16; 'wrote:': 0.16; '>': 0.18; 'email addr:gmail.com>': 0.18; 'to:2**1': 0.21; 'passing': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; 'message- id:@mail.gmail.com': 0.27; "i'm": 0.30; 'push': 0.30; 'probably': 0.31; "can't": 0.32; 'anybody': 0.32; 'list': 0.34; 'received:google.com': 0.35; 'received:74.125.82': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'thank': 0.38; 'rather': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'you.': 0.64; 'due': 0.65; 'smith': 0.76; 'local,': 0.84; 'program!': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=F5fhjpHYCGjeI6WE5I6q6J3G86dqWRf9x4m3uB2A4TQ=; b=tEzq/tFsxknb2Gaky72xLc2gcDz4yf7Zta1kpABwkiPOV6gu732FN+OYTDxUVVc40m wxm6rPIUFt4xulnfZu/Uv7pnsGPDf56zQ7zT1ViAd/mjGhuNNwTXcQ9ubqskGE16jkHR U/TFXz71MH26Yj+HLNHryBzWjrhHF2UqHwGxyBLNiZZHARF28XQwCqXuJQa4PL8oxvVc 3o/4QFIkyImYWMQPe5iUShippZX80xxL7pESzF/xLG1rgrms0wOpsnDkAFBrqLGrw+dF fkN6jrVOPiQjtQiddl32k4wJKlYonpQmM9w02QXuN7l+CasJkykhc3nCrSnPy8YAQ0VK rMhQ== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=F5fhjpHYCGjeI6WE5I6q6J3G86dqWRf9x4m3uB2A4TQ=; b=aklVK74N77icZQlME/OkmIUuM099zUFeDx0Xc9JRRem2xbkTsFziAjgF5XrUV1M05c GoG6E2e61UQIFYxgFMQhEGI8hBK4zW3QaKoaoMjgGnkg5sCPiFACn9twEHhBvcSsivVY 7tbPf9WNvjjxfqxCFRLePeiuyTScCyo9nYJ0Z3uIliVEp25ITO+ZtdUtN4e+Hu9fn96b FBUYwN1f+GHuKFr50MKLx8Ql1T7Y+Owq9H5Lp0RN04VdMPyVVHux8Y1zV7xd+mPaItkd MgvM3MDPXPN9iriHGJGF3+1Xi5zAyx5QjIEyRlaZNGb4dnksovPcMJwKb3aKfHtAHKm8 XvhQ== |
| X-Gm-Message-State | AD7BkJK31qdxUjJGxBws70Y0AimYWt+ZF7WOync0hPGE6ZWFBXzm3DGklluLIbysGtKYWReW7Ka5Ymtc1to6ig== |
| X-Received | by 10.194.184.38 with SMTP id er6mr1620920wjc.93.1460013966184; Thu, 07 Apr 2016 00:26:06 -0700 (PDT) |
| In-Reply-To | <ne4vo4$htk$1@dont-email.me> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.21 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <CAGgTfkOHXCsyRsa2ea5difNVJQ6uQxULw2HE36aw6Sac3Yx6MQ@mail.gmail.com> |
| X-Mailman-Original-References | <ne3r48$bk8$1@dont-email.me> <ne3rhv$e1e$1@dont-email.me> <ne4vo4$htk$1@dont-email.me> |
| Xref | csiph.com comp.lang.python:106620 |
Show key headers only | View raw
On Thu, Apr 7, 2016, 7:51 AM Charles T. Smith <cts.private.yahoo@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. >
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
recursive methods require implementing a stack? "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2016-04-06 20:21 +0000
Re: recursive methods require implementing a stack? Rob Gaddi <rgaddi@highlandtechnology.invalid> - 2016-04-06 20:28 +0000
Re: recursive methods require implementing a stack? "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2016-04-07 06:46 +0000
Re: recursive methods require implementing a stack? Michael Selik <michael.selik@gmail.com> - 2016-04-07 07:25 +0000
csiph-web