Duncan Booth wrote:
> In practice it is impossible to write code in Python (or most 
> languages) with only one return point from a function: any line could throw 
> an exception which is effectively another return point, so the cleanup has 
> to be done properly anyway.

def funcWithGuaranteedOneExitPoint():
     try:
         # do some stuff, or
         pass
     finally:
         return None

Of course, you might have mistyped something (e.g. "none") and still 
manage to get an exception, but at least in the above example it's still 
only a single exit point, even if not the one you thought it was. ;-)

-Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to