Queue enhancement suggestion
Paul Rubin
http
Mon Apr 16 22:54:51 EDT 2007
Jean-Paul Calderone <exarkun at divmod.com> writes:
> Instead of putting multiple sentinels, just pre-construct the iterator
> object.
> work = iter(q.get, sentinel)
> Re-use the same iterator in each thread, and you'll get the behavior
> you're after.
Whaaat???!!!! Can I dooooo that? It looks like it depends on the
insides of iter being thread-safe, which I wouldn't have been
willing to assume. Am I missing something? Thanks.
More information about the Python-list
mailing list