On Thu, Feb 11, 2010 at 9:32 AM, mk <span dir="ltr"><<a href="mailto:mrkafk@gmail.com">mrkafk@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Simon Brunning wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Not as far as I know. Besides, the chances are that if you were to be<br>
able to turn off exception handling altogether your code wouldn't make<br>
it as far as the code you are interested in anyway.<br>
</blockquote>
<br></div>
Sure, but I could deal with that, jerry-rigging the code as exceptions go by, finally reaching the exception I care about.<br>
<br>
With all the problems, this would still be much better than nothing. As thing are, the only way to do this is guessing and turning particular try / except blocks off.<br>
<br>
(a really nifty solution would be turning exceptions on or off per module / file basis).<br>
<br>
IIRC Lua and/or C++ do have this ability, why not Python?<br>
<br>
I smell material for a PEP.</blockquote><div><br></div><div>Um, Lua has nothing even vaguely like Python's exceptions. It has errors, and you can "catch" them only by doing a protected call. Otherwise they halt the entire interpreter. </div>
<div><br></div><div>Python exceptions are pervasive. I don't think you fully understand HOW pervasive they are-- "turning off" exceptions would utterly break a -vast- amount of Python code. Exceptions are not errors: exceptions are the uncommon, the exceptional, case. If one could somehow turn off exceptions, you can't even do a for loop: every for loop would become infinite-- exceptions are how Python signals the end of an iterator. Think about that, *every* for loop in Python suddenly breaks. </div>
<div><br></div><div>They're also used in countless other areas which are simply not errors.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is there some way you could monkey patch the exception class to add<br>
some logging in there or something?<br>
</blockquote>
<br></div>
Sure I can, but how do I get out of Python the info *what called particular class/instance*? That is, how do I know who's the caller?<br></blockquote><div><br></div><div>Um... run your code in a debugger.</div><div><br>
</div><div>That's what debugger's are -for-.</div><div><br></div><div>"pdb" is a simple one. Various IDE's have more advanced ones.</div><div><br></div><div>I think you're better served showing us what, "I'm getting an exception (on socket) handled..." actually means, what is actually happening with real code and output, and getting pointers on where to look, then trying to gather material to support an honestly impossible change :)</div>
<div><br></div></div><div name="mailplane_signature">--S</div>