[Python-Dev] New PEP: 319

Guido van Rossum guido@python.org
Sun, 15 Jun 2003 21:58:01 -0400


> On Sun, Jun 15, 2003, michel@dialnetwork.com wrote:
> > 
> > After doing a whole heck of a lot of Java and Jython programming over
> > the last year I decided to work an idea of mine into a PEP after being
> > impressed with Java thread syncronization and frustrated with Python
> > (it's almost always the other way around...)
> >
> > http://www.python.org/peps/pep-0319.html

[Aahz]
> You need to be *much* clearer about the proposed interface between the
> ``synchronize`` keyword and Python objects.

I agree with Aahz; especially the scope of the lock used by an
anonymous synchronize block is ambiguous in the current PEP.  In one
example it appears that there is a lock associated with each
unqualified use of the synchronize keyword; in another, it seems that
unqualified uses in the same class share a lock.

Please try to explain the semantics of named and unnamed synchronize
calls entirely in terms of code that would work in current Python,
without using English (other than "this code is equivalent to that
code").

I'd also like to see how 'asynchronize' works with condition
variables, which seem to be the most common use for temporarily
unlocking.  (Your example of how code would do this without
asynchronize has a bug, by the way; if the I/O operation raises an
exception, the finally clause will attempt to release an already
released lock.)

I think the PEP would be clearer if it was considerably shorter and to
the point, with fewer examples and a more exact specification.

--Guido van Rossum (home page: http://www.python.org/~guido/)