Crappy Python code of the day
Rick Johnson
rantingrickjohnson at gmail.com
Tue Feb 28 18:16:07 EST 2017
More information about the Python-list mailing list
Tue Feb 28 18:16:07 EST 2017
- Previous message (by thread): Crappy Python code of the day
- Next message (by thread): print odd numbers of lines from tekst WITHOUT space between lines
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wednesday, February 15, 2017 at 10:16:14 PM UTC-6, Steven D'Aprano wrote: > Oh, we know why the code is failing. We don't need help > diagnosing the UnboundLocalError exception. You're right: > there's an except pass around an assignment, so if the > assignment fails, `result` never gets set. > > But the real WTF is that the ConnectionError is just thrown > away. There's no attempt to recover from it, or log it, or > try connecting again... the end result is that the > application dies with an unhelpful UnboundLocalError, and > (until today) we had no idea what the actual cause of the > failure was. Perhaps the "writer of the code" (*AHEM* as you so eloquently put it), was disgruntled, and decided to leave a little "present" for the next code monkey to find. And now, thanks to you, he/she is tasting the sweet nectar of revenge.
- Previous message (by thread): Crappy Python code of the day
- Next message (by thread): print odd numbers of lines from tekst WITHOUT space between lines
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list