[issue18676] Queue: document that zero is accepted as timeout value

Richard Oudkerk report at bugs.python.org
Thu Aug 8 00:13:41 CEST 2013


Richard Oudkerk added the comment:

> IMHO it just doesn't make sense passing 0.0 as a timeout value.

I have written lots of code that looks like

    timeout = max(deadline - time.time(), 0)
    some_function(..., timeout=timeout)

This makes perfect sense.  Working code should not be broken -- it is the docsting that should be changed.

I can't think of *any* function taking a timeout which rejects a zero timeout.  See select(), poll(), Condition.wait(), Lock.acquire(), Thread.join().  In each case a zero timeout causes a non-blocking call.

Also, note that the implementation does not contradict the docstring or documentation: they say nothing about what happens it timeout is zero (or negative).

----------
nosy: +sbt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18676>
_______________________________________


More information about the Python-bugs-list mailing list