Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100443
| From | Vincent Davis <vincent@vincentdavis.net> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Try: rather than if : |
| Date | 2015-12-14 17:20 -0700 |
| Message-ID | <mailman.9.1450138879.22044.python-list@python.org> (permalink) |
| References | <CALyJZZViT33d8iob-5PoYnJOdPU2RzSzt3YAic_GRaAxN+wE1A@mail.gmail.com> <20151214231420.GA20631@cskk.homeip.net> <CALyJZZWn-UJPkMtNOBX9YcvAmWgA4qTo7_LwhHjciwevmrn1xw@mail.gmail.com> <CALwzid=32c_ELw5=-LY9ad8yrCPCMrqnaU2Z9QfvceCFZ7rOQQ@mail.gmail.com> |
On Mon, Dec 14, 2015 at 4:53 PM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
>
> Except that catching an exception just to immediately re-raise it is
> silly. This would be better:
>
> try:
> name = handle.name
> except AttributeError:
> pass
> else:
> handle.write("# Report_file: %s\n" % name)
Ya that would be silly.
Thanks everyone for the education.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Try: rather than if : Vincent Davis <vincent@vincentdavis.net> - 2015-12-14 17:20 -0700
csiph-web