François Pinard wrote: > > > f = None > > > try: > > > f = action1(...) > > > ... > > > finally: > > > if f is not None: > > > action2(f) > > f = action1() > > try: > > ... > > finally: > > action2(f) > > I can't see how this would ever do something different than your version. > Oh, the problem is that if `action1()' raises an exception (and this is > why it has to be within the `try', not before), `f' will not receive > a value, and so, may not be initialised in all cases. The (frequent) > stunt is a guard so this never becomes a problem. in Guido's solution, the "finally" clause won't be called at all if action1 raises an exception. </F>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4