Path: csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.039 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'subtle': 0.09; 'skip:1 30': 0.15; 'thu,': 0.15; 'effect,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'isnt': 0.16; 'mean,': 0.16; 'subject:recursion': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'number)': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'sort': 0.25; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'sure,': 0.29; 'tail': 0.29; 'point': 0.33; 'call,': 0.33; 'received:google.com': 0.35; 'but': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'missing': 0.37; 'doing': 0.38; 'here.': 0.62; 'ending': 0.63; 'worth': 0.67; 'chrisa': 0.84; 'hardly': 0.84; 'recursion,': 0.84; 'subject:this': 0.85; 'to:none': 0.91; 'technically': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=C0AJqrS6ZrgoGi2EbCSnotrDQsFhBNc0dhh8so7gd00=; b=MRD61ZNTd9CukrS4aU2w02/DY4kUh3u6EC9gZKp/Py/TL2O7+0e5tXSFpxv9KVAxVy TFRs/UgK9Xf8b/tHhIsydU3KQqxvTZ6cjpRPbFzzNMh3lnt+T7cy4u7eNMb5owA65ujm 7mY4awnCMyi2lHwLAJPz3SdRzr4ZvVeliHp9xnWZDv6u/QM+34n5dVGMNqJ4vKaHW4g4 4+wYet3dPhSpMW7H41fBTJjul5CCZZp+RS29HQqD7gIzSSZhjr9wp0xYbk3noPy/Cbmt KwSq0pr3XEYIpw6ro2M+X8chA3e+9zAhM916nckCb1gEqj4o0kDvMs3KtQF0tS66irz7 ZGzA== MIME-Version: 1.0 X-Received: by 10.107.12.141 with SMTP id 13mr10081044iom.157.1438790081782; Wed, 05 Aug 2015 08:54:41 -0700 (PDT) In-Reply-To: References: <53903f1c-a740-4508-9d24-0b0bec9ad339@googlegroups.com> Date: Thu, 6 Aug 2015 01:54:41 +1000 Subject: Re: Is this an example of tail recursion? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1438790090 news.xs4all.nl 2904 [2001:888:2000:d::a6]:53393 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95025 On Thu, Aug 6, 2015 at 1:37 AM, wrote: > Sorry I am missing a subtle point: Isnt 1+ self.soldiersVsDefenders... ending up calling 1.__add__(self.soldiersVsDefenders...)? I think his point is that it is, in effect, doing that; but honestly, calling this a tail call into the int+int addition function is pretty pointless. I mean, sure, it's technically a sort of tail call, but it's definitely not tail recursion, and it's such a trivial operation (adding one to a probably-small number) that it's hardly even worth mentioning. The main point of tail recursion is how it interacts with the self-call, and that's not the tail call here. ChrisA