Re: Suggested python feature: allowing except in context maneger

Liste des GroupesRevenir à cl python 
Sujet : Re: Suggested python feature: allowing except in context maneger
De : sjeik_appie (at) *nospam* hotmail.com (Albert-Jan Roskam)
Groupes : comp.lang.python
Date : 16. Jun 2024, 22:41:52
Autres entêtes
Message-ID : <mailman.141.1718574125.2909.python-list@python.org>
References : 1 2
     The example exception is not what bothers me. The syntax change is
     nowhere near as useful as `with` and context managers. They provide an
     excellent idiom for resource usage and release.

     Your suggestion complicates the `with` statement and brings only a tiny
     indentation reduction over the `with`-inside-`try` idiom. It brings no
     semantic changes or new features.

   ====
   I also don't see the added value. If you desperately want to get rid of an
   indentation level, you could use an except
   hook. https://docs.python.org/3/library/sys.html#sys.excepthook

Date Sujet#  Auteur
16 Jun 24 o Re: Suggested python feature: allowing except in context maneger1Albert-Jan Roskam

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal