[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-dev
Subject:    Re: [Python-Dev] PEP 310 and exceptions
From:       Josiah Carlson <jcarlson () uci ! edu>
Date:       2005-04-23 2:03:20
Message-ID: 20050422190222.63D2.JCARLSON () uci ! edu
[Download RAW message or body]


hpk@trillke.net (holger krekel) wrote:
> basically translates to: 
> 
>     if hasattr(x, '__enter__'): 
>         x.__enter__() 
>     try: 
>         ... 
>     except: 
>         if hasattr(x, '__except__'): x.__except__(...) 
>         else: x.__exit__()
>     else: 
>         x.__exit__()

Nope...

>>> def foo():
...     try:
...         print 1
...         return
...     except:
...         print 2
...     else:
...         print 3
...
>>> foo()
1
>>> 

 - Josiah

_______________________________________________
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/python-dev%40progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic