Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46257

Re: I want to know how to implement concurrent threads in Python

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <fabiosantosart@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.116
X-Spam-Level *
X-Spam-Evidence '*H*': 0.83; '*S*': 0.06; 'subject:Python': 0.06; 'concurrently': 0.07; 'socket': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; 'concurrent': 0.16; 'gonna': 0.16; 'subject:threads': 0.16; 'wrote:': 0.18; 'module': 0.19; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'cc:no real name:2**0': 0.24; '&gt;': 0.26; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'didnt': 0.31; 'pipe': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'module.': 0.36; 'doing': 0.36; 'tasks': 0.38; 'does': 0.39; 'how': 0.40; 'most': 0.60; "you've": 0.63; 'real': 0.63; 'to:addr:gmail.com': 0.65; 'cut': 0.74; 'cc:addr:yahoo.co.uk': 0.84; 'fired': 0.84; 'subject:know': 0.84; 'execution,': 0.91; 'subject:want': 0.91; 'choice.': 0.93; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=561k0mJZ6MDxTRkby3UHJniu+IAgHKbJXeE6+FZqsLY=; b=G0hiH1YTkazYEOXr4lALdmlzxHCWHbU+A8wmlTfQPzKlKzrEQLJJgwzdQpXt8PP+H7 CkwD/N5XuthDtzC0vlUy3e86NGwDtu0A1wyTSl6rbrh5KaQz8DkMK/FBlUl2PhwZ5MOA etbX8BBxolFD+gEHRRQ+3cEnJlNUvsLr7rRMwRDMUSM+m6k5oWDR68WCYxERAtt/G8Yn qILST/p4s3+H6OUTIDgnabO/c/zYGZsrQm5wCp5VtRlKmyMCtNRT3Pvew7uB46/gXLUR AupXJi93Xjbkaq+4KYGmJ6Nfc6/xM3hOKpycEENe3wiXMlPb0JKnOFG10+J/h0FrAP/T tvBg==
MIME-Version 1.0
X-Received by 10.49.26.198 with SMTP id n6mr34674764qeg.16.1369720943281; Mon, 27 May 2013 23:02:23 -0700 (PDT)
In-Reply-To <CAGpAtSGJNVniWdoJsFPaFNSndCTB55CteAbjYxEpMWvXZf-uFg@mail.gmail.com>
References <CAGpAtSFH5Gn1xWuPKhGm-Bo0OZi0PgOD+9O-KC=MpCXJ20bC6w@mail.gmail.com> <knu24m$egq$5@ger.gmane.org> <CAGpAtSGJNVniWdoJsFPaFNSndCTB55CteAbjYxEpMWvXZf-uFg@mail.gmail.com>
Date Tue, 28 May 2013 07:02:23 +0100
Subject Re: I want to know how to implement concurrent threads in Python
From Fábio Santos <fabiosantosart@gmail.com>
To Daniel Gagliardi <danielgagliardiramos@gmail.com>
Content-Type multipart/alternative; boundary=047d7b67730444295904ddc102bd
Cc Mark Lawrence <breamoreboy@yahoo.co.uk>, python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.2281.1369720946.3114.python-list@python.org> (permalink)
Lines 41
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369720946 news.xs4all.nl 15865 [2001:888:2000:d::a6]:34293
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46257

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 28 May 2013 05:06, "Daniel Gagliardi" <danielgagliardiramos@gmail.com>
wrote:
>
> fuck! fuck! i'm gonna be fired if i didnt get this shit! i told my boss
id do it. fuck! im gonna pipe some crakc. fuck...

So do it. You've already been told how to.

It's true that python does not do real concurrent execution, but if most of
your threads spend most time sleeping, waiting on a socket or doing IO,
those are opportunities for other threads to cut in and execute
concurrently and the threading module is your best choice.

If you need to do cpu-intensive tasks concurrently, use the multiprocessing
module.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: I want to know how to implement concurrent threads in Python Fábio Santos <fabiosantosart@gmail.com> - 2013-05-28 07:02 +0100

csiph-web