try...else
Robin Becker
robin at jessikat.fsnet.co.uk
Fri Dec 22 13:02:27 EST 2000
I had expected that in try: except: else
the else clause always got executed, but it seems not for return
PythonWin 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on
win32.Portions Copyright 1994-2000 Mark Hammond (MarkH at ActiveState.com)
- see 'Help/About PythonWin' for further copyright information.
>>> def bang():
... try:
... return 'return value'
... except:
... print 'bang failed'
... else:
... print 'bang succeeded'
...
>>> bang()
'return value'
>>>
is this a 'feature' or bug. The 2.0 docs seem not to mention
return/continue except for try finally.
--
Robin Becker
More information about the Python-list
mailing list