How to pop the interpreter's stack?

Tim Arnold tim.arnold at sas.com
Wed Dec 15 12:38:50 EST 2010


"Ethan Furman" <ethan at stoneleaf.us> wrote in message 
news:mailman.4.1292379995.6505.python-list at python.org...
> 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~

I thought people would advise using a decorator for this one. Wouldn't that 
work?
thanks,
--Tim 





More information about the Python-list mailing list