[Python-de] try ... except Python 2+3?

Andreas Jung lists at zopyx.com
Fr Sep 18 15:39:02 CEST 2015


Wie kaputt....das ist nicht mal mehr ansatzweise pythonic

Sent from a mobile device

> Am 18.09.2015 um 13:34 schrieb Peter Otten <__peter__ at web.de>:
> 
> Andreas Jung wrote:
> 
>>> On 17 Sep 2015, at 18:28, Ulli Horlacher wrote:
>>> 
>>> 
>>>  except socket.error as (errn,errm):
>> 
>> 
>> Was soll der Code überhaupt hier machen? Eine Exception fangen und als
>> Tuple speichern? Macht für mich nicht viel Sinn.
> 
> Automatisch entpacken, als Abkürzung für
> 
> except socket.error as err:
>    errn, errm = err
>    del err
> 
> Dafür muss die Exception natürlich "iterable" sein wie in Python 2:
> 
> $ python -c 'print(list(Exception()))'
> []
> 
> 
> _______________________________________________
> python-de maillist  -  python-de at python.org
> https://mail.python.org/mailman/listinfo/python-de


Mehr Informationen über die Mailingliste python-de