[Python-Dev] release candidate rules and timeit API question

Guido van Rossum guido@python.org
Tue, 01 Jul 2003 11:50:49 -0400


>     Guido> I wonder if the right refactoring wouldn't be to add an acquire
>     Guido> with timeout method to the built-in lock type?

[Sjoerd]
> In my case I use await_condition() to gracefully empty a Queue of database
> connection objects at termination time.
[...]
> It's a bit clunky, but I wouldn't be able to use an acquire() with a
> timeout directly.  I'd need a Queue.get with a timeout as well.

Yes, but that API change would be useful anyway.

> Besides, wouldn't there be places where this progressive backoff
> would be useful in non-threaded contexts?

Unclear, but it's unclear to me if it really is more readable with a
helper function to express the condition passed in rather than just
written out explicitly (everyone writes these a little different, and
that's just fine with me).

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