What's the use of the else in try/except/else?
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Tue May 12 04:23:25 EDT 2009
In message <gu7f97$mt6$2 at reader1.panix.com>, kj wrote:
> I know about the construct:
>
> try:
> # do something
> except ...:
> # handle exception
> else:
> # do something else
>
> ...but I can't come with an example in which the same couldn't be
> accomplished with [no else]
I'd agree. If you have to resort to a "try .. else", then might I
respectfully suggest that you're using exceptions in a way that's
complicated enough to get you into trouble.
More information about the Python-list
mailing list