Why the different parameter signatures to indicate blocking/timeouts.

Antoon Pardon antoon.pardon at rece.vub.ac.be
Wed Aug 19 13:05:52 CEST 2015


I have been looking through the threading module and I am
a bit annoyed at the different signatures for indicating
whether some calls should block or not and the timeout.

On the one hand we have the acquire on locks with the following
signature: def accquire(blocking=True, timeout=-1)

On the other hand we have wait and join methods with this
signature: def join(timeout=None).

As far as I understand 

timeout=None is equivallent to: blocking=True, timeout=-1
timeout=NR   is equivallent to: blocking=True, timeout=NR.
timeout=0    is equivallent to: blocking=False, timeout=-1

which may be equivallent to : blocking=True, timeout=0

Can someone explain why these different signatures, or
should I consider this a relict from the past?

-- 
Antoon Pardon ////



More information about the Python-list mailing list