Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25541
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <panisson@di.unito.it> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python': 0.09; 'callback': 0.09; 'issue?': 0.09; 'overridden': 0.09; 'subject:skip:m 10': 0.09; 'def': 0.10; '2.7.3': 0.16; 'andr\xe9': 0.16; 'etc....': 0.16; 'range(20):': 0.16; 'result:': 0.16; 'stumbling': 0.16; 'all,': 0.21; 'import': 0.21; 'seems': 0.23; 'header:User- Agent:1': 0.26; 'executing': 0.27; 'behaviour': 0.29; "i'm": 0.29; 'print': 0.32; 'ubuntu': 0.33; 'to:addr:python-list': 0.33; 'skip:- 20': 0.34; 'subject:with': 0.36; 'being': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'strange': 0.62; 'behavior': 0.64; 'received:130': 0.75 |
| X-MailScanner-From | panisson@di.unito.it |
| X-SpamCheck | not spam, SpamAssassin (not cached, score=-102.441, required 3, autolearn=not spam, AUTHENTICATEDUSER -100.00, AWL -0.63, BAYES_00 -1.90, RCVD_IN_DNSWL_LOW -0.70, RDNS_NONE 0.79, SPF_PASS -0.00) |
| X-AntiVirus | Email Clean |
| X-dipinfo-MailScanner-ID | q6HLiRiS024528 |
| X-dipinfo-MailScanner-Information | Please contact Department of Computer Science technical staff for more information |
| X-DKIM | OpenDKIM Filter v2.4.1 pianeta.di.unito.it q6HLiRiS024528 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/simple; d=di.unito.it; s=dipinfo2011; t=1342561472; bh=9DXnhco2a8cBcSDcVKta8oXQqdu+jWhPLXZ+ZblByOI=; h=Message-ID:Date:From:MIME-Version:To:Subject:Content-Type; b=DR8Ic4+xdHaioZgCw5+lFp1rdaK2rsP97Caxe+5zOEm2mpsU5OZzJ5n1QNwbM2rNw zv8DAZ5Ql3XTsnDxlDfRICtsRxzaW2s588A6zt/nAvklvhB48vztppNH3lMdu69ARY DDI2IEvRSFZIsmEQSnuQtiQHqmSH1jL1KlskHGLM= |
| Date | Tue, 17 Jul 2012 23:44:27 +0200 |
| From | André Panisson <panisson@di.unito.it> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | multiprocessing: apply_async with different callbacks |
| Content-Type | multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="------------ms050500090808090109050409" |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2250.1342561966.4697.python-list@python.org> (permalink) |
| Lines | 121 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1342561966 news.xs4all.nl 6853 [2001:888:2000:d::a6]:36395 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:25541 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hi all,
I'm having a strange behavior when executing the following script:
---------------------------
import multiprocessing
def f(i):
return i
p = multiprocessing.Pool()
for i in range(20):
def c(r):
print r, i
p.apply_async(f, (i,) , callback=c)
p.close()
p.join()
---------------------------
Result:
0 6
1 11
2 13
3 15
4 15
5 19
etc....
It seems that the callbacks of all submitted tasks are being overridden
with the last callback submitted by apply_async.
Is this the right behaviour or I am stumbling in some issue? I'm using
Python 2.7.3 @ Ubuntu 12.04
Regards,
André
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
multiprocessing: apply_async with different callbacks André Panisson <panisson@di.unito.it> - 2012-07-17 23:44 +0200
csiph-web