Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Laura Creighton Newsgroups: comp.lang.python Subject: Re: python response slow when running external DLL Date: Sat, 28 Nov 2015 11:51:55 +0100 Lines: 16 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: news.uni-berlin.de 9eohFmF/hQ/do0KFwwx4PwkHhKyCW1FBvIB9lpCxus6A== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'line:': 0.07; 'purpose.': 0.07; 'cc:addr:python-list': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'thread': 0.10; 'python': 0.10; 'subject:python': 0.14; '"while': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'constructs': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'logical.': 0.16; 'message-id:@fido.openend.se': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'recipe': 0.16; 'subject:slow': 0.16; 'subject:when': 0.16; 'threading': 0.16; 'to:addr:web.de': 0.16; 'wrote:': 0.16; 'obviously': 0.16; 'laura': 0.18; '2015': 0.20; 'cc:addr:python.org': 0.20; 'preferred': 0.20; 'cc:2**1': 0.22; 'sat,': 0.23; 'import': 0.24; 'thus': 0.24; 'module': 0.25; 'sense': 0.26; 'module.': 0.27; 'interface': 0.29; 'received:se': 0.29; 'thread,': 0.29; 'cc:no real name:2**1': 0.29; 'code': 0.30; 'nov': 0.35; 'level': 0.35; 'should': 0.36; '(and': 0.36; 'subject:: ': 0.37; 'charset:us- ascii': 0.37; 'why': 0.39; 'your': 0.60; 'header:Message-Id:1': 0.61; 'replying': 0.61; 'more': 0.63; 'reply': 0.68; 'saw': 0.77; 'low': 0.83; 'header:In-reply-to:1': 0.84; 'otten': 0.84; 'mistake': 0.91; 'scheduling': 0.91; 'subject:response': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openend.se; s=default; t=1448707921; bh=lcnUM53sMywS0NjydvwkvSxde9BzvvrmWdSGDeG6TQM=; h=To:cc:From:Subject:In-reply-to:References:Date:From; b=sU52nvk7cuX6iJBPsTuQLr73EpNBB2yP1ePBL5QD2E6lmvwnqePU9ySc8lUXaEb0t zNj8LAZqVK4rkOduGBhGbaM8VTrtJFVguXSFcJXvpzvRPnt2hhVWAFCP+gkAywxsK0 K+QEljz1La2xuGaVB0s+YiJss7O5fy5VygjKPmZ0= In-reply-to: Comments: In-reply-to Peter Otten <__peter__@web.de> message dated "Sat, 28 Nov 2015 11:13:38 +0100." Content-ID: <16623.1448707915.1@fido> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [82.96.5.2]); Sat, 28 Nov 2015 11:52:01 +0100 (CET) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99658 In a message of Sat, 28 Nov 2015 11:13:38 +0100, Peter Otten writes: >jfong@ms4.hinet.net wrote: >> Using thread is obviously more logical. I think my mistake was the "while >> busy: pass" loop which makes no sense because it blocks the main thread, >> just as the time.sleep() does. That's why in your link (and Laura's too) >> the widget.after() scheduling was used for this purpose. I never saw the reply that Peter is replying to. The threading module constructs a higher level interface on top of the low level thread module. Thus it is the preferred way to go for standard Python code -- and even Fredrik's recipe contains the line: import thread # should use the threading module instead! Laura