Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "D'Arcy J.M. Cain" Newsgroups: comp.lang.python Subject: Re: Why not allow empty code blocks? Date: Fri, 29 Jul 2016 12:28:50 -0400 Organization: Vex.Net Lines: 26 Message-ID: References: <5792cd34$0$1587$c3e8da3$5496439d@news.astraweb.com> <87vazwppxx.fsf@elektro.pacujo.net> <579B1ABB.1070500@rece.vub.ac.be> <20160729071458.1dfa170f@imp> <579b5d8c$0$1615$c3e8da3$5496439d@news.astraweb.com> <579B603B.60102@rece.vub.ac.be> <20160729122850.16164872@imp> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de zsPo8MLMuBTHWpG5E8lW4gJdpuAA2nuqE8J/Um1FgdxA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'debug': 0.04; 'false.': 0.07; 'subject:code': 0.07; 'cc:addr:python-list': 0.09; 'exception,': 0.09; 'subject:Why': 0.09; 'subject:not': 0.11; 'ignore': 0.14; '2016': 0.16; 'fancy': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:allow': 0.16; 'wrote:': 0.16; 'try:': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '+0200': 0.20; 'cc:no real name:2**0': 0.22; 'header:In-Reply- To:1': 0.24; 'fri,': 0.27; 'logging': 0.27; 'useful': 0.33; 'class': 0.33; 'usually': 0.33; 'purposes,': 0.33; 'file': 0.34; 'except': 0.34; 'handle': 0.34; 'false': 0.35; 'but': 0.36; 'instead': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'charset :us-ascii': 0.37; 'seem': 0.37; 'log': 0.38; 'where': 0.40; 'some': 0.40; 'chance': 0.60; 'more': 0.63; 'day.': 0.63; 'information': 0.63; 'times': 0.63; 'today': 0.65; 'rare': 0.66; 'levels': 0.70; 'jul': 0.72; 'pardon': 0.84; 'received:98.158': 0.84 In-Reply-To: <579B603B.60102@rece.vub.ac.be> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20160729122850.16164872@imp> X-Mailman-Original-References: <5792cd34$0$1587$c3e8da3$5496439d@news.astraweb.com> <87vazwppxx.fsf@elektro.pacujo.net> <579B1ABB.1070500@rece.vub.ac.be> <20160729071458.1dfa170f@imp> <579b5d8c$0$1615$c3e8da3$5496439d@news.astraweb.com> <579B603B.60102@rece.vub.ac.be> Xref: csiph.com comp.lang.python:112023 On Fri, 29 Jul 2016 15:55:07 +0200 Antoon Pardon 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@Vex.Net VoIP: sip:darcy@Vex.Net