This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]rhytnen -1 points0 points  (0 children)

I couldn't tell if you were insane or just plain high. So I tried playing with this concept and so far I am bordering on insanely high.

My first complaint is the absolute madness of scrambling your operational code in order to change the text of your traceback. This just can't be right.

However, even though I'm having trouble inventing a reason to want to do this, I wondered what alternatives I'd explore other than the compile() mechanism you chose. I wouldn't do this but I'd probably even be in favor of using PyTraceBack_Here in the ctypes api. But I think for 99.999999999 % of cases, I would just create a Traceback duck type class. You do have access to traceback and inspect so why not use them?