Try: rather than if :
Vincent Davis
vincent at vincentdavis.net
Mon Dec 14 19:20:57 EST 2015
On Mon, Dec 14, 2015 at 4:53 PM, Ian Kelly <ian.g.kelly at 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.
More information about the Python-list
mailing list