[Python-Dev] PEP 343 and __with__

Phillip J. Eby pje at telecommunity.com
Mon Oct 3 21:20:34 CEST 2005

At 07:02 PM 10/3/2005 +0100, Michael Hudson wrote:
>"Phillip J. Eby" <pje at telecommunity.com> writes:
> > Since the PEP is accepted and has patches for both its implementation 
> and a
> > good part of its documentation, a major change like this would certainly
> > need a better rationale.
>Though given the amount of interest said patch has attracted (none at

Actually, I have been reading the patch and meant to comment on it.  I was 
perplexed by the odd stack behavior of the new opcode until I realized that 
it's try/finally that's weird.  :)  I was planning to look into whether 
that could be cleaned up as well, when I got distracted and didn't go back 
to it.

>  perhaps noone cares very much and the proposal should be dropped.

I care an awful lot, as 'with' is another framework-dissolving tool that 
makes it possible to do more things in library form, without needing to 
resort to template methods.  It also enables more context-sensitive 
programming, in that "global" states can be set and restored in a 
structured fashion.  It may take a while to feel the effects, but it's 
going to be a big improvement to Python, maybe as big as new-style classes, 
and certainly bigger than decorators.

More information about the Python-Dev mailing list