[Python-Dev] Why did Fredrik leave the party?

Barry A. Warsaw barry@python.org
Wed, 5 Feb 2003 10:25:16 -0500


>>>>> "GvR" == Guido van Rossum <guido@python.org> writes:

    GvR> There's also the tension between making the language simpler
    GvR> (to learn) and making programs simpler (to read).  For
    GvR> example, *if* (and that's still a very big if) we were to add
    GvR> a language feature that would let you write

    |     synchronized(lock):
    |         BLOCK

    GvR> instead of

    |     lock.aqcuire()
    |     try:
    |         BLOCK
    |     finally:
    |         lock.release()

The real problem is that the second example isn't even correct, if you
want to be totally anal about it. ;)  You really need an atomic
operation to acquire the lock and enter the try block, which the
second example doesn't give you.  It's a narrow window of failure but
it exists, and you have to decide whether you care.  So the first
example doesn't /just/ improve readability, it improves correctness
too (assuming it is also atomic).

-Barry