[Python-Dev] PEP 343 and __with__

Michael Hudson mwh at python.net
Tue Oct 4 10:50:16 CEST 2005


"Phillip J. Eby" <pje at telecommunity.com> writes:

> 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
>>all)
>
> Actually, I have been reading the patch and meant to comment on it.  

Oh, good.

> 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.

I see.

I don't know whether trying to clean up the stack protocol around
exceptions is worth the about of pain it causes in the head (anyone
still thinking about removing the block stack?).

>>  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.

I think 'as big as new-style classes' is probably an exaggeration, but
I'm glad my troll caught a few people :)

Cheers,
mwh

-- 
  Those who have deviant punctuation desires should take care of their
  own perverted needs.                  -- Erik Naggum, comp.lang.lisp


More information about the Python-Dev mailing list