Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95025
| References | <53903f1c-a740-4508-9d24-0b0bec9ad339@googlegroups.com> <eb5d250a-aa9a-4cf1-9123-ab64a2188538@googlegroups.com> <bbcb163b-43a2-497a-8782-4228de0cb6e9@googlegroups.com> |
|---|---|
| Date | 2015-08-06 01:54 +1000 |
| Subject | Re: Is this an example of tail recursion? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1242.1438790090.3674.python-list@python.org> (permalink) |
On Thu, Aug 6, 2015 at 1:37 AM, <jennyfurtado2@gmail.com> 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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is this an example of tail recursion? jennyfurtado2@gmail.com - 2015-08-05 08:13 -0700
Re: Is this an example of tail recursion? Rustom Mody <rustompmody@gmail.com> - 2015-08-05 08:21 -0700
Re: Is this an example of tail recursion? jennyfurtado2@gmail.com - 2015-08-05 08:37 -0700
Re: Is this an example of tail recursion? Chris Angelico <rosuav@gmail.com> - 2015-08-06 01:54 +1000
Re: Is this an example of tail recursion? Rustom Mody <rustompmody@gmail.com> - 2015-08-05 09:10 -0700
Re: Is this an example of tail recursion? jennyfurtado2@gmail.com - 2015-08-05 09:15 -0700
Re: Is this an example of tail recursion? Chris Angelico <rosuav@gmail.com> - 2015-08-06 02:28 +1000
Re: Is this an example of tail recursion? jennyfurtado2@gmail.com - 2015-08-05 09:41 -0700
Re: Is this an example of tail recursion? Rustom Mody <rustompmody@gmail.com> - 2015-08-05 09:51 -0700
Re: Is this an example of tail recursion? Chris Angelico <rosuav@gmail.com> - 2015-08-06 03:10 +1000
Re: Is this an example of tail recursion? Chris Angelico <rosuav@gmail.com> - 2015-08-06 01:51 +1000
Re: Is this an example of tail recursion? jenny <jennyfurtado2@gmail.com> - 2015-08-05 08:59 -0700
csiph-web