Hi Ideas,
I frequently find myself in the following situations:
1) I wish to do something if no exception is thrown, for instance:
try:
logger.debug('Fiber starting: %s', self)
try:
self._result = self._routine()
finally:
logger.debug('Fiber finished: %s', self)
except:
raise
else:
raise FiberExit(self)
finally:
self._finished.set()
unregister_fiber(self)
Here it's sufficient that that if an exception is already present, I
don't need to raise another. The except clause is clearly pointless.
2) I'm experimenting with catching various exceptions and remove the
last except clause. I need to put a finally: pass; to avoid having to
restructure all my code, since this is currently the only way to
maintain the try-except-else-finally statement without catching dummy
exceptions.
I propose that the except clause be optional.
Cheers,
Matt https://www.assortlist.com
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/6VK32X4KCRG4BFP3MXJ6KVIN4GKDRGRT/
Code of Conduct: http://python.org/psf/codeofconduct/