Philippe Sigaud: > I was wondering how to create generic > recursive functions from strings like "a + self(b)". Now, I can get the > function name, replace self with it and mix the code in the right place.
Time ago I have proposed the function name to be contained in a variable named __function__ inside every Python function, and named something like __func inside D programs. The advantage is to follow DRY, and avoid repeating the function name two times. So if later you change the name of a *self* recursive function, your program keeps working correctly (it doesn't work with mutually recursive functions, but they are quite less common in non-functional code). With it you may even create self-recursive lambdas and self-recursive delegates created from class methods. This very simple feature was appreciated by some people, but it has not seen light both in Python and D. Bye, bearophile