Re: [Python-Dev] PEP 343 and __with__

At 05:15 PM 10/3/2005 -0400, Jason Orendorff wrote:
Wha? For locks (the example you originally gave), this is trivial.
Okay, it was completely non-obvious from your post that this was the problem you're trying to solve.
This could also be done with a Context.replace() @contextmanager method. On the whole, I'm torn. I definitely like the additional flexibility this gives. On the other hand, it seems to me that __with__ and the additional C baggage violates the "if the implementation is hard to explain" rule. Also, people have already put a lot of effort into implementation and documentation patches based on an accepted PEP. That's not enough to override "the right thing to do", especially if it comes with a volunteer willing to update the work, but in this case the amount of additional goodness seems small, and it's not immediately apparent that you're volunteering to help change this even if Guido blessed it.
participants (1)
-
Phillip J. Eby