Accessing a shared generator from multiple threads.
Aahz
aahz at pythoncraft.com
Fri Jan 30 21:00:34 EST 2004
In article <cab22418.0401220800.1d5f8594 at posting.google.com>,
Jim Jewett <JimJJewett at yahoo.com> wrote:
>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.
You've got a good point. All right, I suggest you subscribe to
python-dev (if you're not) and bring it up there so we can hash out
which location would be best for this functionality.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code --
not in reams of trivial code that bores the reader to death." --GvR
More information about the Python-list
mailing list