Why not allow empty code blocks?

D'Arcy J.M. Cain darcy at Vex.Net
Fri Jul 29 12:28:50 EDT 2016


On Fri, 29 Jul 2016 15:55:07 +0200
Antoon Pardon <antoon.pardon at rece.vub.ac.be> wrote:
> I think the case where you just want to ignore the exception, but it
> can at times be useful to get some extra logging information for
> debuging purposes, is not that rare as you seem to suggest.

The way I handle that is:

DEBUG = False # near top of file
...
try:
   block
except SomeException:
    if DEBUG: log("Blah blah blah")

Usually it's in a class so it would be "self.DEBUG".  You can also get
fancy with debug levels instead of True and False.

My theory is that if I need to log it today there's a more than zero
chance I might need to log it again one day.

-- 
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:darcy at Vex.Net
VoIP: sip:darcy at Vex.Net



More information about the Python-list mailing list