Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84849
| Date | 2015-01-29 11:32 -0600 |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Subject | Re: The Most Diabolical Python Antipattern |
| References | <madpuv$he7$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18285.1422570637.18130.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: The Most Diabolical Python Antipattern Tim Chase <python.list@tim.thechases.com> - 2015-01-29 11:32 -0600
csiph-web