the death of lecter
Peter Hansen
peter at engcorp.com
Mon Sep 11 23:45:33 EDT 2000
More information about the Python-list mailing list
Mon Sep 11 23:45:33 EDT 2000
- Previous message (by thread): the death of lecter
- Next message (by thread): the death of lecter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Alex Martelli wrote: > > "Michal Wallace" <sabren at manifestation.com> wrote in message > > * extended 'try' syntax: > > try: > > print 'do something' > > except: > > print 'catch errors' > > finally: > > print 'clean up' # not allowed in real Python > > > > # not sure why you'd want to do this, but the fact that you > > # can't seems kind of sad.. :) > > You just have to nest it: > try: > try: > print "foo" > except: > print "errors" > finally: > print "clean up" > > I do agree that an optionally finally-clause after 1 or more except > clauses (and possibly an else clause too) on a try would make for a > nice alternative to this rather cumbersome nested syntax where except > (& maybe else) and finally are mutually exclusive. And in some cases, it might be more appropriate to use: try: try: print "spam" finally: print " and eggs" except: print "Ping!" I wonder whether the proposed combined method try/except/finally could just as easily support try/finally/except. -- ------------------------------------------- Peter Hansen, P.Eng.
- Previous message (by thread): the death of lecter
- Next message (by thread): the death of lecter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list