Self function

bearophileHUGS at bearophileHUGS at
Tue May 5 22:43:16 CEST 2009

> It is easy to change all references of the function name, except for
> those in the function body itself? That needs some explantation.

I can answer this. If I have a recursive function, I may want to
create a similar function, so I copy and paste it, to later modify the
copied version. Then to change its name I usually don't use a search &
rename of its name into its block of code because it's usually
useless. In non-recursive functions the name of the function is stated
only once, at the top.

Recursive functions violate the DRY principle, that's the root of the

The auto(f) decorator shown later by Aaron Brady seems the best
solution found so far, it's so nice that it even seems practically


More information about the Python-list mailing list