On Thursday, December 30, 2021 at 11:23:35 PM UTC+8, Chris Angelico wrote: > If it's an exception, it needs to subclass Exception or BaseException.
I see. That is, the following: class TailRecurseException(Exception): def __init__(self, args, kwargs): self.args = args self.kwargs = kwargs > (Also, is this REALLY an optimization? Exception handling isn't the > fastest. Yes, it avoids some measure of recursion depth, but it looks > like a pretty inefficient way to do things. Python is not Lisp, and > there are very very few algorithms that actually benefit from tail > call optimization that wouldn't benefit far more from other ways of > doing the same thing.) Could you give some examples of the other methods you mentioned above? > ChrisA HZ -- https://mail.python.org/mailman/listinfo/python-list