[Python-Dev] if debug: except Exception, e: pdb.set_trace() (original) (raw)

Calvin Spealman ironfroggy at gmail.com
Mon Oct 9 09:24:28 CEST 2006


I know I can not do this, but what are the chances on changing the rules so that we can? Basically, since the if debug: lines are processed before runtime, would it be possible to allow them to be used to control the inclusion or omission or entire blocks (except, else, elif, etc.) with them being included as if they were at the same level as the 'if debug:' above them?

I want to allow this:

try: foo() if debug: except Exception, e: import pdb pdb.set_trace()

So that when debug is false, the except block doesn't even exist at all.

Read my blog! I depend on your acceptance of my opinion! I am interesting! http://ironfroggy-code.blogspot.com/



More information about the Python-Dev mailing list