
On Sun, Aug 7, 2011 at 2:00 PM, Jim Jewett <jimjjewett@gmail.com> wrote:
On Sun, Aug 7, 2011 at 1:36 AM, Steven D'Aprano <steve@pearwood.info> wrote:
For most uses, standard recursion via the name is good enough, it's only a few corner cases where self-reflection (as I call it) is needed.
Self-reflection is a purity issue. Are you worried about obscure bugs when something else hijacks the name of your function (or module or class), but your function is still somehow runnable?
If you worry about that every time you write a recursive function you'll go insane.
Practicality Beats Purity, but purity still has some value. I will also note that names are particularly likely to get reused in some contexts (GUIs, security proxies) where the writer of the original code can't rely on anything about the runtime environment.
There are some standard situations where some standard recipes apply. But it's best to use those sparingly or your code will become unreadable.
I don't think that use-case is so important that it should be implicitly added to every function, on the off-chance it is needed, rather than explicitly on demand.
Right. -- --Guido van Rossum (python.org/~guido)