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-June/054041.html below:

[Python-Dev] PEP 343 rewrite complete

[Python-Dev] PEP 343 rewrite complete [Python-Dev] PEP 343 rewrite completePhillip J. Eby pje at telecommunity.com
Wed Jun 1 18:16:56 CEST 2005
At 08:16 AM 6/1/2005 -0700, Guido van Rossum wrote:
>I hope that I've got the rewrite of PEP 343 to include generator
>extensions right now. I've chosen the 'with' keyword. Please review
>here; I think this is ready for review by the unwashed masses. :-)
>
>   http://www.python.org/peps/pep-0343.html


Looks great.  A few questions/comments:

* What's the rationale for raising TypeError from close()?  Wasn't 
RuntimeError discussed previously for that role?  (and it's also used by 
the with_template example)  OTOH, maybe that means we want a 
ControlFlowError or some such that can be used for both.

* The "opening" example under "Generator Decorator" seems to be missing a 
try/finally block.

* The transaction handler could also be written as:

     @with_template
     def transactional(db):
         db.begin()
         try:
             yield db
         except:
             db.rollback()
         else:
             db.commit()

at least, if I understand it correctly.
  

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