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. _______________________________________________ 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/archive%40mail-archive.com