A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-April/052858.html below:

[Python-Dev] PEP 310 and exceptions

[Python-Dev] PEP 310 and exceptions [Python-Dev] PEP 310 and exceptionsJosiah Carlson jcarlson at uci.edu
Sat Apr 23 04:03:20 CEST 2005
hpk at 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

More information about the Python-Dev mailing list

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