Iterative vs. Recursive coding
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Thu Aug 19 20:26:45 EDT 2010
On Thu, 19 Aug 2010 22:00:16 +0000, Martin Gregorie wrote:
> Recursion can be quite a trick to get your mind round at first
Really? Do people actually find the *concept* of recursion to be tricky?
If I remember correctly, my puzzlement about recursion lasted about 15
seconds. I remember thinking "How does the function foo know that there
is a function foo when foo doesn't fully exist yet?", but once I accepted
the fact that it just does it all just seemed obvious. Getting recursion
*right* is sometimes tricky, but the idea itself isn't.
But then, I grew up watching Doctor Who, and had no problem with the idea
that the TARDIS could materialise *inside itself*. And from a very early
age, I was familiar with a particular brand of Advocaat liquor where the
label on the bottle contained a picture of a rooster holding a bottom of
Advocaat, whose label contained a picture of a rooster holding a bottle
of Advocaat, whose label contained a picture of a rooster holding a
bottle, whose label ... well, you can see where that is going.
--
Steven
More information about the Python-list
mailing list