Moshe Zadka wrote: > > On Thu, 28 Dec 2000, "M.-A. Lemburg" <mal@lemburg.com> wrote: > > > He does have a point however that 'return' will bypass > > try...else and try...finally clauses. I don't think we can change > > that behaviour, though, as it would break code. > > It doesn't bypass try..finally: > > >>> def foo(): > ... try: > ... print "hello" > ... return > ... finally: > ... print "goodbye" > ... > >>> foo() > hello > goodbye Hmm, that must have changed between Python 1.5 and more recent versions: Python 1.5: >>> def f(): ... try: ... return 1 ... finally: ... print 'finally' ... >>> f() 1 >>> Python 2.0: >>> def f(): ... try: ... return 1 ... finally: ... print 'finally' ... >>> f() finally 1 >>> -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
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