Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.135 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.75; '*S*': 0.02; '(b)': 0.07; '\xc2\xa0i': 0.16; 'trying': 0.19; 'to:name:python-list@python.org': 0.22; '(a)': 0.24; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'piece': 0.31; 'received:google.com': 0.35; 'there': 0.35; 'options:': 0.36; 'subject:List': 0.36; 'list': 0.37; 'to:addr :python-list': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'subject:skip:C 10': 0.61; '8bit%:10': 0.64; 'opt': 0.97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=SN6QU1DQNvBLaSZkk15Xj0XvsehJmqtmuVwLpBfHw30=; b=Rfe7IzdzbWIDhGZtU21djVstDKoOaHrw04YBuwta0fYGOAdgoggRcmfWxXSvNLab3C mVYwvGsHBvAogb7Rpru1mReqpfTZK+oDP+PXrxgRuQOCoarawR5VXPCrIOcVTyazEYFa B06HLHuQMnEiyt+Zy7C+c6HjNG71NG1Z1wx8j9LgiDtiNOjcf/RxvVdvbY2BGimCKJxF RwlwFotSpOrmcg8+dgWAuo9RbMot2+X+QXAUUVKsF8nkRwykwSxCG/5NmllAwHRQDa5A 52f5zNX3YJoR1PjYKwXyXytL4coXphUx+/J0z/dhqlr9TVcg7FDv7NX2Czhrnu1JJl7z TZjA== MIME-Version: 1.0 X-Received: by 10.152.197.5 with SMTP id iq5mr20106107lac.6.1419226956991; Sun, 21 Dec 2014 21:42:36 -0800 (PST) Date: Mon, 22 Dec 2014 11:12:36 +0530 Subject: List Comprehensions From: Ganesh Pal To: "python-list@python.org" Content-Type: multipart/alternative; boundary=001a11341530a090f6050ac7866f 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: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1419226965 news.xs4all.nl 2919 [2001:888:2000:d::a6]:39372 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4655 X-Received-Body-CRC: 1002799289 Xref: csiph.com comp.lang.python:82751 --001a11341530a090f6050ac7866f Content-Type: text/plain; charset=UTF-8 Hi , (a) I was trying to reduce the below piece of code using List comprehension ? Any suggestion please let me know for opt in options: opt['result'] = Queue.Queue() tmp_thread = pause.Thread(opt) threads.append(tmp_thread) tmp_thread.start() (b) * Is there anything that I need to consider while using list comprehension with threads ?* Regards, Ganesh --001a11341530a090f6050ac7866f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi ,


(a) =C2=A0I was try= ing to reduce the below piece of code using List comprehension ? Any sugges= tion please let me know=C2=A0


= =C2=A0 =C2=A0 =C2=A0for opt in options:
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 opt['result'] =3D Queue.Queue()
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 tmp_thread =3D pause.Thread(opt)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 threads.append(tmp_thread)
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0tmp_thread.start()

(b)=C2=A0=C2=A0 =C2=A0Is there anyth= ing that I need to consider while using list comprehension with threads ?


Regards,

Ganesh


--001a11341530a090f6050ac7866f--