[Python-ideas] revisit pep 377: good use case?

Arnaud Delobelle arnodel at gmail.com
Wed Feb 29 21:29:43 CET 2012


On 29 February 2012 17:49, Craig Yoshioka <craigyk at me.com> wrote:
> I've tried classes, decorators, and passing the conditional using 'as', as
> suggested by Michael,  so I disagree that with is not suitable here since I
> have yet to find a better alternative.  If you want I can give pretty
> concrete examples in the ways they aren't as good.  Furthermore, I think it
> could be argued that it makes more sense to be able to safely skip the with
> body without the user of the with statement having to manually catch the
> exception themselves....

>From PEP 343:

 But the final blow came when I read Raymond Chen's rant about
 flow-control macros[1]. Raymond argues convincingly that hiding
 flow control in macros makes your code inscrutable, and I find
 that his argument applies to Python as well as to C.
So it is explicitly stated that the with statement should not be
capable of controlling the flow.
-- 
Arnaud
[1] Raymond Chen's article on hidden flow control
http://blogs.msdn.com/oldnewthing/archive/2005/01/06/347666.aspx


More information about the Python-ideas mailing list

AltStyle によって変換されたページ (->オリジナル) /