Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84928
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: The Most Diabolical Python Antipattern |
| Date | 2015-01-31 01:28 +0000 |
| References | <madpuv$he7$1@ger.gmane.org> <20150129113238.7eaa986d@bigbox.christie.dr> <mailman.18286.1422571931.18130.python-list@python.org> <87r3uchjyg.fsf@elektro.pacujo.net> <mafeat$bff$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18325.1422667744.18130.python-list@python.org> (permalink) |
On 30/01/2015 08:10, Mark Lawrence wrote: > On 30/01/2015 06:16, Marko Rauhamaa wrote: >> Ian Kelly <ian.g.kelly@gmail.com>: >> >>> At least use "except Exception" instead of a bare except. Do you >>> really want things like SystemExit and KeyboardInterrupt to get turned >>> into 0? >> >> How about: >> >> ============================== >> try: >> do_interesting_stuff() >> except ValueError: >> try: >> log_it() >> except: >> pass >> raise >> ============================== >> >> Surprisingly this variant could raise an unexpected exception: >> >> ============================== >> try: >> do_interesting_stuff() >> except ValueError: >> try: >> log_it() >> finally: >> raise >> ============================== >> >> A Python bug? >> >> >> Marko >> > > It depends on the Python version that you're running - I think!!! See > https://www.python.org/dev/peps/pep-3134/ > https://www.python.org/dev/peps/pep-0409/ > https://www.python.org/dev/peps/pep-0415/ and finally try (groan :) > https://pypi.python.org/pypi/pep3134/ > http://bugs.python.org/issue23353 looks like fun and references PEP3134 for anybody who's interested. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: The Most Diabolical Python Antipattern Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-29 15:51 -0700
Re: The Most Diabolical Python Antipattern Marko Rauhamaa <marko@pacujo.net> - 2015-01-30 08:16 +0200
Re: The Most Diabolical Python Antipattern Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-30 08:10 +0000
Re: The Most Diabolical Python Antipattern Marko Rauhamaa <marko@pacujo.net> - 2015-01-30 11:02 +0200
Re: The Most Diabolical Python Antipattern Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-30 02:17 -0700
Re: The Most Diabolical Python Antipattern Marko Rauhamaa <marko@pacujo.net> - 2015-01-30 12:00 +0200
Re: The Most Diabolical Python Antipattern Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-30 08:21 -0700
Re: The Most Diabolical Python Antipattern Marko Rauhamaa <marko@pacujo.net> - 2015-01-30 17:30 +0200
Re: The Most Diabolical Python Antipattern Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-30 08:42 -0700
Re: The Most Diabolical Python Antipattern Marko Rauhamaa <marko@pacujo.net> - 2015-01-30 17:56 +0200
Re: The Most Diabolical Python Antipattern Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-30 09:38 -0700
Re: The Most Diabolical Python Antipattern Chris Angelico <rosuav@gmail.com> - 2015-01-31 02:55 +1100
Re: The Most Diabolical Python Antipattern Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-30 02:11 -0700
Re: The Most Diabolical Python Antipattern Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-31 01:28 +0000
csiph-web