Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'handler': 0.05; 'alter': 0.09; 'iterate': 0.09; 'skip:2 30': 0.09; 'summary.': 0.09; 'cheers': 0.12; 'thread': 0.14; 'loop.': 0.16; 'mutable': 0.16; 'non-blocking': 0.16; 'sequential': 0.16; 'subject:Pypy': 0.16; 'thread?': 0.16; 'threads,': 0.16; 'threads.': 0.16; 'wrote:': 0.18; 'feb': 0.22; 'example': 0.22; 'decide': 0.24; 'paul': 0.24; 'this:': 0.26; 'point': 0.28; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'that.': 0.31; 'safely': 0.31; 'another': 0.32; 'says': 0.33; 'url:python': 0.33; "can't": 0.35; 'usual': 0.35; 'received:google.com': 0.35; 'data,': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; "i'll": 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'so,': 0.37; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'url:2012': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'even': 0.60; 'back': 0.62; 'url:blogspot': 0.65; 'account': 0.65; 'holding': 0.65; 'reply': 0.66; 'between': 0.67; 'fact,': 0.69; 'article': 0.77; 'transfer': 0.82; '2015': 0.84; 'look.': 0.84; 'safer': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:from:date:message-id:subject:to :content-type; bh=n56/iXjhKp/srXAZTkkq53iSzZ//9M0Umh/MksP1SGg=; b=mzo7KYSF9FbnRQwWxfzmEreATAc4MDyptwr3C5BChFcYZA8nFXsWvN8Zfiu2jwoZLa aWD+v8Bzi1hayCI0CGqI0OzgJ4uumi5EuDzEscNR67pIHWYOHp5Uq4Fg5OhcK4n+vWuQ ATpKhMq89C3x6Qfffbyv/ZOLAfzUfqwaKIAFCmiDJK8Z5IjaS+27UQAGlIcx/1hgG47+ ZwRI+zBWTeGKfUCicc+l/k7TLMY62Gw4aWYPdYWVYtRJMrN238fztDHJ2IVc2VUzmjnj px6L5M2dNSrjdMh9KpjhAQlYhmUvkU7nRGCGwpd/3zXCO2YvwLjog2kzwx7nDt/CsmT9 zHtQ== X-Received: by 10.69.27.15 with SMTP id jc15mr15506231pbd.126.1424664016447; Sun, 22 Feb 2015 20:00:16 -0800 (PST) MIME-Version: 1.0 References: <87fv9xdb22.fsf@jester.gateway.pace.com> <54ea7ff4$0$12983$c3e8da3$5496439d@news.astraweb.com> <87zj85bcyu.fsf@jester.gateway.pace.com> <87lhjpb89i.fsf@jester.gateway.pace.com> From: Ryan Stuart Date: Mon, 23 Feb 2015 04:00:16 +0000 Subject: Re: Future of Pypy? To: python-list@python.org Content-Type: multipart/alternative; boundary=001a113835ac9fee5f050fb9703e X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 79 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424664024 news.xs4all.nl 2874 [2001:888:2000:d::a6]:38374 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86191 --001a113835ac9fee5f050fb9703e Content-Type: text/plain; charset=UTF-8 On Mon Feb 23 2015 at 1:50:40 PM Paul Rubin wrote: > That article is about the hazards of mutable state shared between > threads. The key to using threads safely is to not do that. So the > "transfer" example in the article would instead be a message handler in > the thread holding the account data, and it would do the transfer in the > usual sequential way. You'd start a transfer by sending a message > through a Queue, and get back a reply through another queue. > I think that is a pretty accurate summary. In fact, the article even says that. So, just to iterate its point, if you are using non-blocking Queues to communicate to these threads, then you just have a communicating event loop. Given that Queues work perfectly with with processes as well, what is the point of using a thread? Using a process/fork is far safer in that someone can't "accidentally" decide to alter mutable state in the future. > You might like this: > > http://jlouisramblings.blogspot.com/2012/08/getting- > 25-megalines-of-code-to-behave.html Thanks for this, I'll take a look. Cheers > > -- > https://mail.python.org/mailman/listinfo/python-list > --001a113835ac9fee5f050fb9703e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Mon Feb 23 2015 at 1:50:40 P= M Paul Rubin <no.email@nospam.invalid> wrote:
That article is about the hazards of mutable state shared betwee= n
threads.=C2=A0 The key to using threads safely is to not do that.=C2=A0 So = the
"transfer" example in the article would instead be a message hand= ler in
the thread holding the account data, and it would do the transfer in the usual sequential way.=C2=A0 You'd start a transfer by sending a message=
through a Queue, and get back a reply through another queue.

I think that is a pretty accurate summary. In fact, t= he article even says that. So, just to iterate its point, if you are using = non-blocking Queues to communicate to these threads, then you just have a c= ommunicating event loop. Given that Queues work perfectly with with process= es as well, what is the point of using a thread? Using a process/fork is fa= r safer in that someone can't "accidentally" decide to alter = mutable state in the future.
=C2=A0
You might like this:

http://jlouisramblings.bl= ogspot.com/2012/08/getting-25-megalines-of-code-to-behave.htm= l

Thanks for this, I'll take a look= .

Cheers
=C2=A0

--
https://mail.python.org/mailman/listinfo/python-list
--001a113835ac9fee5f050fb9703e--