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.

-j


This:

    with EXPR as VAR:
        BLOCK

would expand to this under PEP 342 and my proposal:

    _cm = (EXPR).__with__()
    VAR = _cm.next()
    try:
        BLOCK
    except:
        _cm.throw(*sys.exc_info())
    finally:
        try:
            _cm.next()
        except (StopIteration, GeneratorExit):
            pass
        else:
            raise RuntimeError("coroutine didn't finish")
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to