[Python-Dev] PEP 343 and __with__
jason.orendorff at gmail.com
Tue Oct 4 16:51:11 CEST 2005
Right after I sent the preceding message I got a funny feeling I'm
wasting everybody's time here. I apologize. Guido's original concern
about speedy C implementation for locks stands. I don't see a good
way around it.
By the way, my expansion of 'with' using coroutines (in previous
message) was incorrect. The corrected version is shorter; see below.
with EXPR as VAR:
would expand to this under PEP 342 and my proposal:
_cm = (EXPR).__with__()
VAR = _cm.next()
except (StopIteration, GeneratorExit):
raise RuntimeError("coroutine didn't finish")
More information about the Python-Dev