Queue enhancement suggestion

Paul Rubin http
Tue Apr 17 04:54:51 CEST 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