On Tue, Oct 20, 2020 at 11:43 PM <71f13...@powerencry.com> wrote: > > 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.
Why not just put the raise FiberExit into the body of the try? ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/YJBETRK6FT2N5FWESDN4WEYSBCJGWHHY/ Code of Conduct: http://python.org/psf/codeofconduct/