You can implement tail call optimization in python via a decorator, but it's pretty much overkill for just populating a dictionary: http://code.activestate.com/recipes/474088/
On Wed, Feb 9, 2011 at 5:28 PM, cjrh <[email protected]> wrote: > On Feb 9, 5:15 pm, Massimo Di Pierro <[email protected]> > wrote: > > Not in python. It has no tail recursion so it will crash the > > interpreter if you have more than ~1000 terms (depending on how python > > was compiled). > > That's an implementation detail! sys.setrecursionlimit(n) can get you > quite far, however :) > > The main problem with using recursion is that most colleagues will be > unable to understand or debug your code. This is by far the greatest > value consideration, and very few problems justify recursion when > python is so richly packed with intelligent iterators and generous > generators. > > >

