Re: Tail Call Optimization as a Decorator

2006-03-03 Thread Michel Salim
Neat stuff! I commented on the ActiveState post, but for completeness, I modified your code to support mutual recursions, and used jorend's isTailCall() to make it safe to call an optimized function in a non-tail-call context. http://the-dubois-papers.blogspot.com/2006/03/python-tail-call-decorato

Re: Tail Call Optimization as a Decorator

2006-02-26 Thread Kay Schluehr
Crutcher wrote: > I've tossed it to python-dev, but how do I submit it to the cookbook? http://aspn.activestate.com/ASPN/Python/Cookbook/ I think it is a good place to stay accessible even if python-dev overlooks it. Kay -- http://mail.python.org/mailman/listinfo/python-list

Re: Tail Call Optimization as a Decorator

2006-02-26 Thread Crutcher
I've tossed it to python-dev, but how do I submit it to the cookbook? -- http://mail.python.org/mailman/listinfo/python-list

Re: Tail Call Optimization as a Decorator

2006-02-26 Thread Kay Schluehr
Crutcher wrote: > This is fun :) > {Note: I take no responsibilty for anyone who uses this in production > code} > > #!/usr/bin/env python2.4 > # This program shows off a python decorator > # which implements tail call optimization. It > # does this by throwing an exception if it is > # it's own g

Tail Call Optimization as a Decorator

2006-02-26 Thread Crutcher
This is fun :) {Note: I take no responsibilty for anyone who uses this in production code} #!/usr/bin/env python2.4 # This program shows off a python decorator # which implements tail call optimization. It # does this by throwing an exception if it is # it's own grandparent, and catching such # ex