Object-oriented philosophy

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Sep 6 22:42:56 EDT 2018


On Thu, 06 Sep 2018 22:00:26 +0100, MRAB wrote:

> On 2018-09-06 21:24, Michael F. Stemper wrote:
[...]
>>    try:
>>      P_0s = xmlmodel.findall( 'RatedPower' )[0].text 
>>      self.P_0 = float( P_0s )
>>    except:
[...]

> A word of advice: don't use a "bare" except, i.e. one that doesn't
> specify what exception(s) it should catch.

Excellent advice!

More here:

https://realpython.com/the-most-diabolical-python-antipattern/





-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list