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


Groups > comp.lang.python > #81679

Re: Fwd: Python Signal/Slot + QThred code analysis

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <juan0christian@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; 'subject: + ': 0.07; 'subject:code': 0.07; 'callback': 0.09; 'question.': 0.14; 'thread': 0.14; "wouldn't": 0.14; 'invokes': 0.16; 'redo': 0.16; 'reproduce': 0.16; 'scope.': 0.16; 'str),': 0.16; 'str,': 0.16; 'stuff,': 0.16; 'stuff.': 0.16; 'subject:analysis': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'possible,': 0.19; 'code,': 0.22; 'email addr:gmail.com&gt;': 0.22; 'print': 0.22; 'load': 0.23; 'mind.': 0.24; 'sends': 0.24; 'pass': 0.26; 'subject:/': 0.26; 'michael': 0.29; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; "skip:' 10": 0.31; 'object.': 0.31; 'stuff': 0.32; 'problem': 0.35; 'done.': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'data,': 0.36; 'doing': 0.36; 'web,': 0.36; "i'll": 0.36; 'possible': 0.36; 'being': 0.38; 'fri': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'signal': 0.60; 'new': 0.61; 'subject:Fwd': 0.61; 'first': 0.61; 'more': 0.64; 'different': 0.65; 'fire': 0.65; 'here': 0.66; 'invalid': 0.68; 'risk': 0.72; 'asynchronous': 0.84; 'urls,': 0.91
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=CzLGjj+K0C/iB8fvYL6Hr7h3NmsG0Bm4UvRoDFwklTw=; b=Xaxckr/xb2PV5hHoj0PDW2HGdIJTukbzNGW7tU0b4cwjdM1sr17m9qTMS0Sc8c9Y1X W8+2JnooHUWyBrCDE5I61FZVIVB+3dxh4DP0Knel42PHdWPSc0Su25CU1/9E4GCRuWO8 oHXDSoxteuHx14ePu0QIhqvh0nwdlBnkdu0oDQzQB6o3p9O7Bdim1TvXIy0nKOsGz0PC U5JU0lOHZXUDNBdEC3D5rm2jvrWaADXq3gkf0RQyGIjJQBCbQCqZqb4ByEy0gr6S/Syv 4/h5l5ddiT46PNV6l9/5nOq0sjBE/70vWmQCq63/dVNTeFQ4trrpqE53fZAjrDMQ0j7t HXhg==
X-Received by 10.224.46.66 with SMTP id i2mr61857503qaf.72.1417180017120; Fri, 28 Nov 2014 05:06:57 -0800 (PST)
MIME-Version 1.0
References <CAAp0bGttki1B=1q5SX_C39L_dRB22YOQiTbVxdvo4jSee0srcw@mail.gmail.com> <CAAp0bGsgMTK7MS1Wvh13304et7Bb7XUyfZTU8ZmF2++BuLj7dw@mail.gmail.com> <5473E188.5020608@gmail.com> <CAAp0bGtYCEWNLV7tnR6O5N706_3AkO9XRBs1pNP8TCxfctUyow@mail.gmail.com> <5474A333.2090207@mrabarnett.plus.com> <CAAp0bGsGLsWoXQnqFYN3KLeUsmcD5ujF80sasM16wx70zQ1xUA@mail.gmail.com> <CAAp0bGvhhWcLO76UQ+nXZuhazjJr9wsjwBkuCX78O4K=em9wuQ@mail.gmail.com> <5474C889.5090503@mrabarnett.plus.com> <CAAp0bGtv13QaPhfTx+tzSe6ZpQ9RCLiWrG1Cv+qfEw3JZ41o9g@mail.gmail.com> <547545CF.60208@gmail.com> <CAAp0bGuMRmEXXFpHaVx0MBoQ72N3MYXYwnnxpS58w-LSV6vTdw@mail.gmail.com> <5476A134.7050407@gmail.com> <5476A48C.1050607@gmail.com> <CAAp0bGtirGVFRAdE3-eosTVfwTAeLO0-XcPyY7+JVSsujqs7bg@mail.gmail.com> <5477AB1E.3030609@gmail.com> <CAAp0bGvR+AUiedDdw6KLTmBjJ-PSKvxEnwCxbRj7xB7isFEvMg@mail.gmail.com> <CAAp0bGvypnRutp5MmRV6sOu2iU267TbB-yeyteUN9kH6twVKKw@mail.gmail.com> <5477F4CE.2010701@gmail.com>
From Juan Christian <juan0christian@gmail.com>
Date Fri, 28 Nov 2014 13:06:56 +0000
Subject Re: Fwd: Python Signal/Slot + QThred code analysis
To python-list@python.org
Content-Type multipart/alternative; boundary=001a11c29e0a80ddc90508eaef7b
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16403.1417180019.18130.python-list@python.org> (permalink)
Lines 72
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417180019 news.xs4all.nl 2894 [2001:888:2000:d::a6]:43038
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81679

Show key headers only | View raw


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

On Fri Nov 28 2014 at 2:07:32 AM Michael Torrie <torriem@gmail.com> wrote:
Okay, here's a reworking of the code that invokes a new QThread instance
each time. Note the QThread instance has to be bound to the MainWindow
so that it won't be destroyed when it goes out of scope. Also the
Worker thread sends a signal with the data, so there's no need to check
worker.trades and risk it being invalid data.

Perhaps this would be more what you had in mind.

You may want to look into asynchronous I/O as well. That does not
require threads at all. Fire off a request to load a url, and then get
a callback when it's done.


Now it's working like a charm without any freezes. I'll reproduce this
'Worker' for other stuffs that I need to call the web, but first I have a
question.

Which one would be better in performance, having a single 'Worker' to call
all URLs, having inside this worker functions for each stuff, or having 3~5
different workers doing different stuff. In the end I'll only print the
data when I have them all.

The problem is that I would have a long new_value = Signal(QThread, str,
str), with more then 10 values, is it possible to pass objects here
like new_value = Signal(QThread, ObjA, ObjB, ...) so that in the
'create_topic' I would get the objects and call methods in order to get all
the data?

This approach would be better, because I may be adding more stuff and I
wouldn't need to add tons and tons of new stuff in my signal, only one
object.

You don't need to redo the code, I just need to know if it's a 'good
approach' and if it's possible, from here I can work my way.

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


Thread

Re: Fwd: Python Signal/Slot + QThred code analysis Juan Christian <juan0christian@gmail.com> - 2014-11-28 13:06 +0000

csiph-web