New submission from Jurjen N.E. Bos:

The pool.imap and pool.imap_unordered functions are documented as "a lazy 
version of Pool.map".
In fact, they aren't: they consume the iterator argument as a whole. This is 
almost certainly not what the user wants: it uses unnecessary memory and will 
be slower than expected if the output iterator isn't consumed in full. In fact, 
there isn't much use at all of imap over map at the moment.
I tried to fixed the code myself, but due to the two-level queueing of the 
input arguments this is not trivial.
Stackoverflow's Blckknght wrote a simplified solution that gives the idea how 
it should work.
Since that wasn't posted here, I thought it would be useful to put it here, 
even if only for documentation purposes.

----------
components: Library (Lib)
files: mypool.py
messages: 206279
nosy: jneb
priority: normal
severity: normal
status: open
title: Pool.imap doesn't work as advertised
type: behavior
Added file: http://bugs.python.org/file33158/mypool.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19993>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to