Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.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.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '(b)': 0.07; 'affected': 0.07; 'modifying': 0.07; '22,': 0.09; 'thread': 0.14; 'comp': 0.16; 'wrote:': 0.18; 'mon,': 0.24; '>': 0.26; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'dec': 0.30; 'message- id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'steven': 0.31; 'running': 0.33; 'no,': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'subject:List': 0.36; 'list': 0.37; 'depends': 0.38; 'to:addr:python-list': 0.38; 'anything': 0.39; 'itself': 0.39; 'to:addr:python.org': 0.39; 'affect': 0.61; 'subject:skip:C 10': 0.61 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=M08zFI4aJwObgWIwBybc8V/p8Jr7hWB+DGAfjaw1dZM=; b=ux/DsFIYGDv4CBqPOfsGB35SfUFSbOz/HkwUZlBBKaMx89GJxj3A0qH52jcHrEjKxE CRPaOxHgi+2foBX42So0AXp8MbG5mqzl93GDxYOsRbseEKl/Ts+IlqEXGOb6dcnNaYEc 8vuOV/pPYMsqugXTIxWZbgpm6zNg1om6ZKJ5rQq48RHfBlC8c3PGxaMHcvCpM74tNXgj 5mR1yFLCm2QJzMo+xTc4h4H3inTdM33vKoaoVXI9+fDArzI9Y7s0sMdjptc6XS8BBdGZ q1gNa/t9NDu2+mm4xLepKzBILJaGSa1J4HSA1MEUX0kr4eda5cuI9G3RBQTnDREL3scx o3jA== X-Received: by 10.66.90.161 with SMTP id bx1mr35959831pab.35.1419261217920; Mon, 22 Dec 2014 07:13:37 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <5497e2a2$0$12978$c3e8da3$5496439d@news.astraweb.com> References: <5497e2a2$0$12978$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Mon, 22 Dec 2014 08:12:57 -0700 Subject: Re: List Comprehensions To: Python Content-Type: multipart/alternative; boundary=001a11383b9ebce114050acf8048 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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1419261227 news.xs4all.nl 2894 [2001:888:2000:d::a6]:55425 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82777 --001a11383b9ebce114050acf8048 Content-Type: text/plain; charset=UTF-8 On Mon, Dec 22, 2014 at 2:21 AM, Steven D'Aprano < steve+comp.lang.python@pearwood.info> wrote: > > (b) * Is there anything that I need to consider while using list > > comprehension with threads ?* > > That depends on what you mean by "using list comprehension with threads". > > If you mean "use a list comprehension inside a thread", then no, you don't > need to be concerned. So long as your functions are pure functions with no > side-effects, running a list comp inside one thread cannot affect any other > thread. It could, however, be itself affected by other threads modifying the same data if one isn't careful. --001a11383b9ebce114050acf8048 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Mon, Dec 22, 2014 at 2:21 AM, Steven D'Aprano <<= a href=3D"mailto:steve%2Bcomp.lang.python@pearwood.info">steve+comp.lang.py= thon@pearwood.info> wrote:
> > (b) * =C2=A0 Is there anythi= ng that I need to consider while using list
> > comprehension with= threads ?*
>
> That depends on what you mean by "using li= st comprehension with threads".
>
> If you mean "use = a list comprehension inside a thread", then no, you don't
> = need to be concerned. So long as your functions are pure functions with no<= br>> side-effects, running a list comp inside one thread cannot affect a= ny other
> thread.

It could, however, be itself affected = by other threads modifying the same data if one isn't careful.
--001a11383b9ebce114050acf8048--