[Python-ideas] revisit pep 377: good use case?
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. 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.
 Raymond Chen's article on hidden flow control
More information about the Python-ideas