Yet another Python map()

In another article, I described a replacement for Python's built-in map() function that could take advantage of multi-processing systems. That one was based on the standard Unix fork(). Since then, I've written another based on Parallel Python that is much simpler and lets other, better-tested code do all the hard work. It could also be easily extended to run on a cluster instead of just the local system, but I haven't been inclined to tinker with that too much yet.

Note one possibly important difference from the builtin map() function: this version returns a generator that yields values as they are calculated. That way, you can launch the parallel processes then go on with other work while you give the workers a chance to finish their jobs.

Kudos to Connelly for nudging me to finally publish this.

AttachmentSize
ppmap.py5.58 KB

Comments

'dict' object has no attribute 'map'

What does this error mean?

It looks like others have

It looks like others have had same problem. It's fixed in the new version online now.

Code?

Maybe I'm missing something obvious here, but I don't see a link to your code.

Grrrr... Drupal's "Project

Grrrr... Drupal's "Project Releases" module is giving me fits. The file's attached now.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
four times equals eight
Solve this math question and enter the solution with digits. E.g. for "two plus four = ?" enter "6".