How to pop the interpreter's stack?
Ethan Furman
ethan at stoneleaf.us
Tue Dec 14 21:31:48 EST 2010
kj wrote:
> The one thing I don't like about this strategy is that the tracebacks
> of exceptions raised during the execution of __pre_spam include one
> unwanted stack level (namely, the one corresponding to __pre_spam
> itself).
>
> __pre_spam should be completely invisible and unobtrusive
I am unaware of any way to accomplish what you desire. I also think
this is one of those things that's not worth fighting -- how often are
you going to see such a traceback? When somebody makes a coding
mistake? I would say change the name (assuming yours was a real
example) to something more meaningful like _spam_arg_verifier and call
it good.
Alternatively, perhaps you could make a more general arg_verifier that
could be used for all such needs, and then your traceback would have:
caller
spam
arg_verifier
and that seems useful to me (it is, in fact, how I have mine set up).
Hope this helps!
~Ethan~
More information about the Python-list
mailing list