workerpool: Use itertools.count instead of manual counting
authorMichael Hanselmann <hansmi@google.com>
Fri, 26 Oct 2012 15:38:03 +0000 (17:38 +0200)
committerMichael Hanselmann <hansmi@google.com>
Wed, 7 Nov 2012 13:35:53 +0000 (14:35 +0100)
commitc258f1103f13d5c2ec70aa10cb0dbba877d65fec
treec1e8d8b3f8e80097438c284d75500c74c2a0e3c2
parentb9612abb7e31ea1bddfd390c52a5eb6db2f74c97
workerpool: Use itertools.count instead of manual counting

Instead of having to explicitely increment the value (“… += 1”), a call
to next() is enough. These numbers should in no case be re-used (they
are used for ordering tasks). Using “itertools.count” is useful here as
it guarantees that a returned number won't be returned another time.
Manual code for this could, over the course of time, gain unintended
bugs.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
lib/workerpool.py