On Tue, Dec 29, 2009 at 8:17 AM, Joel Davis <callmeclaud...@gmail.com>wrote:
> did set the tone and I think I've been more than a little tolerant on > this. Someone posts a question, responds back with a "n/m I found the > solution, here it is" and his response is essentially to berate them, > telling them how crappy their code is and that they should at least > _try_ the code. Bear in mind that I even told him the reason he wasn't > able to run it is because he's pasting it into the interactive > terminal. He then responded back AGAIN with the same insults and the > same issue that shows he didn't really even read my last response. > > Please reconsider your attitude to this issue; there is no acceptable defense to your response-- it is flagrantly rude and disrespectful to someone trying to help you. Perhaps you don't appreciate their perceived tone when you repeatedly don't listen to people telling you that this just isn't a place to go, but even if that tone was there, its not even kind of OK to respond the way you did. You don't really get points for not being an ass sooner: that's not tolerance. To your issue, while I don't believe traceback.extract_stack will be going away anytime soon, the use of it for your purpose is something you can't rely on. It works, kind of, because exceptions keep a stack of frames which are examinable -- for the purpose of printing tracebacks. It might work, kind of. In a strictly controlled set of circumstances (which Gabriel articulated) that 'kind of' might be good enough for you. If you're a closed-source or purely internal application in which you have complete control of the scenarios of use, that might be fine. If you intend for anyone else to ever use it or to let this code out of strict control though, then it's an unmitigated mistake to take this approach. You're working directly *against* the language, its entire design and function. You can kind of achieve your result: but its a hack. Some hacks are necessarily evils sometimes, certainly. But they are always fragile. Instead of insulting Steven D'Aprano, perhaps it would be better to answer his question. What are you REALLY trying to solve? What are you REALLY needing to do? Why do you so need to do this? --S
-- http://mail.python.org/mailman/listinfo/python-list