[Tutor] recursion

avi.e.gross at gmail.com avi.e.gross at gmail.com
Mon Aug 15 13:01:28 EDT 2022


Unfortunately, Mats, for some of us TIME grows much faster than MEMORY as we
asymptotically approach our personal ends.

There are things like traversing trees which are harder to do without
recursion but Fibonacci is absolutely trivial to do routinely so no great
reason. And in Python, you can create an iterative solution that is
relatively immortal so we need only live once.

-----Original Message-----
From: Tutor <tutor-bounces+avi.e.gross=gmail.com at python.org> On Behalf Of
Mats Wichmann
Sent: Monday, August 15, 2022 12:35 PM
To: tutor at python.org
Subject: Re: [Tutor] recursion

On 8/14/22 20:57, avi.e.gross at gmail.com wrote:
> Mats,
> 
> I assume you are talking about how recursion to unlimited depths is 
> not a great scheme. Does Python support any form of tail recursion?

it doesn't specifically optimize for it, like some languages may do.

and the problem isn't so much infinity (Python has a recursion limit, and
will just kill the program if it goes out of control), as the amount of
duplication if you don't do something clever, which is why time and memory
grows exponentially.
_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list