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
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
I've tossed it to python-dev, but how do I submit it to the cookbook?
--
http://mail.python.org/mailman/listinfo/python-list
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
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