The Most Diabolical Python Antipattern

Tim Chase python.list at
Thu Jan 29 18:32:38 CET 2015

On 2015-01-29 17:17, Mark Lawrence wrote:
> The author is quite clear on his views here 
> 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):
      return int(val)
      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.


More information about the Python-list mailing list