Accessing a shared generator from multiple threads.
JimJJewett at yahoo.com
Thu Jan 22 17:00:25 CET 2004
aahz at pythoncraft.com (Aahz) wrote in message news:<bun7cn$le7$1 at panix1.panix.com>...
> My point is that I haven't (yet) seen many good use cases for sharing a
> generator between threads, and I'm guessing that many people will try
> using generators inappropriately for problems that really are better
> suited to Queue.Queue.
A globally unique ID, such as:
"What filename should I store this page under?"
The standard library has (several versions of) similar functionality
for temporary filenames. They aren't all threadsafe, they often
enforce the "temporary" aspect, they run into hashing collision
problems eventually, there is no good way to include even approximate
ordering information, etc...
The fact that these are in the standard library suggests that it is a
common use case. The fact that there are several different versions
each with their own problems suggests that the problem is hard enough
to justify putting a good solution in the library.
-jJ Take only memories. Leave not even footprints.
More information about the Python-list