Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'plenty': 0.07; 'except:': 0.09; 'lawrence': 0.09; 'try:': 0.09; 'url:blog': 0.10; 'cc:addr:python-list': 0.11; 'def': 0.12; 'suggest': 0.14; '-tkc': 0.16; 'csv': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'received:174.136': 0.16; 'think?': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'earlier': 0.24; 'guys': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'purposes': 0.26; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; "i'm": 0.30; 'getting': 0.31; 'quite': 0.32; 'url:python': 0.33; 'trouble': 0.34; 'agree': 0.35; 'something': 0.35; 'but': 0.35; 'really': 0.36; 'charset:us-ascii': 0.36; 'should': 0.36; 'received:10': 0.37; 'clear': 0.37; 'that,': 0.38; 'read': 0.60; 'most': 0.60; 'today': 0.64; 'subject:The': 0.64; 'here': 0.66; 'partially': 0.84; 'rubbish': 0.84; 'to:addr:yahoo.co.uk': 0.84 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1422552648449:1642454614 X-MC-Ingress-Time: 1422552648448 Date: Thu, 29 Jan 2015 11:32:38 -0600 From: Tim Chase To: Mark Lawrence Subject: Re: The Most Diabolical Python Antipattern In-Reply-To: References: X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AuthUser: tim@thechases.com Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422570637 news.xs4all.nl 2947 [2001:888:2000:d::a6]:40016 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84849 On 2015-01-29 17:17, Mark Lawrence wrote: > The author is quite clear on his views here > https://realpython.com/blog/python/the-most-diabolical-python-antipattern/ > but what do you guys and gals think? I just read that earlier today and agree for the most part. The only exception (pun only partially intended) I've found is in functions that need to return a defined type. I have one that I call int0() that is my "give me a freakin' int" function which is something like def int0(val): try: return int(val) except: return 0 because I deal with a lot of CSV data from client/vendor that has blanks, "NULL", "---", and plenty of other rubbish to suggest something that, for my purposes is really just a 0. Yes, I've been stung by it occasionally, but it's not much trouble to see that I'm getting a 0 some place that should have a value I need to extract. -tkc