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>
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com