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


Groups > comp.lang.python > #25828

Re: A thread import problem

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <bruce.sherwood@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'importing': 0.04; '21,': 0.07; 'defines': 0.07; 'finished.': 0.07; 'api': 0.09; 'app,': 0.09; 'imports': 0.09; 'received:mail-vb0-f46.google.com': 0.09; 'spawn': 0.09; 'def': 0.10; 'library': 0.15; 'student': 0.15; 'properly': 0.15; 'sat,': 0.15; '"called"': 0.16; '0.001': 0.16; 'animations,': 0.16; 'deferred': 0.16; 'subject:import': 0.16; 'threads': 0.16; 'true:': 0.16; 'vpython': 0.16; 'wrote:': 0.17; 'tries': 0.17; 'thanks,': 0.18; 'saying': 0.18; 'received:209.85.212.46': 0.18; 'module': 0.19; 'putting': 0.20; 'trying': 0.21; 'import': 0.21; 'lets': 0.22; 'subject:problem': 0.22; 'bruce': 0.23; "i've": 0.23; 'allows': 0.25; 'header:In- Reply-To:1': 0.25; '(as': 0.27; 'message-id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'run': 0.28; 'invoke': 0.29; 'wrap': 0.29; 'url:mailman': 0.29; "i'm": 0.29; 'function': 0.30; 'stuff': 0.30; 'code': 0.31; '(and': 0.32; 'url:python': 0.32; 'structure': 0.32; 'running': 0.32; 'url:listinfo': 0.32; 'legacy': 0.33; 'real-time': 0.33; 'url:home': 0.33; 'handle': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'doing': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'loaded': 0.36; 'programmers': 0.36; 'visual': 0.36; 'anything': 0.36; 'does': 0.37; 'level': 0.37; 'being': 0.37; 'received:209': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'url:mail': 0.40; 'solve': 0.62; 'jul': 0.65; 'manner.': 0.66; 'dennis': 0.91; 'novice': 0.91; 'luxury': 0.93
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 :content-type; bh=gd+Vbltn9IieO0LKMGP31k0k6/E+GUi4hbXZBRkZDwU=; b=RGTIPbFR2X7kPohnqT5RsHoaToszjqkVGN1vjbSHzjkhP9QU/RxGudp1rLQQNnxyGV K45mwixcpPqemjWT+r1d2ioeixEAL60oU9ne2y50XKrssNdDR/c1RDiEsdoUJLJ1uHkO s5duifbRwbIDEodriPXUCMATTUhBR+c/eUH16SOPwFCWhOalp2JdiRp2erYXIbJ+3OTu bdqvBEa787LBKkxOJmXhpLNI2FknQ4QJTC6X/FVOAnFSOGymLVT+idMxXNTQ9qUxpHR+ ApgA2iG0mC+r6GNyRojZ2xaaH5tNhsNHyHYT2JTSThaD02nlaiKc0BFAVi41z05fZn+y NyXw==
MIME-Version 1.0
In-Reply-To <5gfm08htgbrum782hfv5fqkb4084qra7vq@invalid.netcom.com>
References <CA+WuaScBDU_5LcrCrTtDr6N3gHCk9hQ03fA=DT359GCRY=a=KQ@mail.gmail.com> <CA+WuaSeRExxaD9yCNWhXoWqsV_ZqP8DOvdErMRdNS-H_UtzQyg@mail.gmail.com> <87a9yt7bw6.fsf@handshake.de> <CA+WuaSc0Rm5s0CXsm7q7-gfyw+jQxpAGkuajpgFyoAHnTP12sQ@mail.gmail.com> <2u8m085co3j3n97jorkl04o5hr1orqb7la@invalid.netcom.com> <CA+WuaSde=GntxGMVTScOUw4_a+jqQS+nme0VpZVgH_219Qo9jA@mail.gmail.com> <5gfm08htgbrum782hfv5fqkb4084qra7vq@invalid.netcom.com>
Date Sun, 22 Jul 2012 13:04:25 -0600
Subject Re: A thread import problem
From Bruce Sherwood <bruce.sherwood@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.2438.1342983873.4697.python-list@python.org> (permalink)
Lines 62
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1342983873 news.xs4all.nl 6853 [2001:888:2000:d::a6]:39455
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25828

Show key headers only | View raw


On Sat, Jul 21, 2012 at 5:47 PM, Dennis Lee Bieber
<wlfraed@ix.netcom.com> wrote:
> On Sat, 21 Jul 2012 17:10:05 -0600, Bruce Sherwood
> <bruce.sherwood@gmail.com> declaimed the following in
> gmane.comp.python.general:
>
>
>> Thanks, but the problem I need to solve does not permit putting a
>> function like runner in the main program. I'm constrained to being
>> able to handle the API of VPython (vpython.org), which lets you write
>> programs like the following (call it user.py), which animates a 3D
>> cube moving to the right, using OpenGL:
>>
>> from visual import box
>> b = box()
>> while True:
>>     b.pos.x += 0.001
>
>         Well, based on that sample, wrap THAT as "runner"
>
> def runner():
>         from visual import box
>         b = box()
>         while True:
>                 b.pos.x += 0.0001
>
> and don't /call/ runner() until after all the main system is configured.
> (And runner could, if need be, be "called" as a thread).
>
>         Not having a Mac, I can't do tests... but everything I've seen so
> far comes down to NOT IMPORTING anything that tries to spawn threads
> /during the import/.
>
>         A properly designed module (as I showed with my testABA.py) only
> "runs" stuff if loaded as the main program; any other use (import) only
> does imports and defines module level entities -- running anything is
> deferred for the program that did the import to invoke AFTER the import
> finished.
> --
>         Wulfraed                 Dennis Lee Bieber         AF6VN
>         wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list

I don't have the luxury of doing things the "approved" way. I'm
constrained by extensive legacy code (and legacy educational
documentation for student use) to be able to run programs such as this
one:

from visual import box
b = box()
while True:
     b.pos.x += 0.001

Another way of saying this is that I'm not building an app, in which
case I would structure things in a simple and straightforward manner.
I am instead trying to maintain and update a library that allows
novice programmers to write programs that generate real-time navigable
3D animations, writing minimalist programs that work cross-platform.

Bruce Sherwood

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


Thread

Re: A thread import problem Bruce Sherwood <bruce.sherwood@gmail.com> - 2012-07-22 13:04 -0600

csiph-web