Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Dennis Lee Bieber Newsgroups: comp.lang.python Subject: Re: raw_input and break Date: Fri, 06 Nov 2015 08:25:31 -0500 Organization: IISS Elusive Unicorn Lines: 41 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de mZHuYslkLOLYLEG7yUZ6EwGHjPK6KOd+nmXbPYkAE2ZA== Return-Path: 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; 'modify': 0.04; 'linear': 0.07; '(1,': 0.09; '3),': 0.09; 'message-id:@4ax.com': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'thread': 0.10; 'sections': 0.13; '"s"': 0.16; '1),': 0.16; '2),': 0.16; 'file).': 0.16; 'left,': 0.16; 'name).': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'skipped': 0.16; 'snippets': 0.16; 'subject:break': 0.16; 'threading': 0.16; 'url:home': 0.18; 'library': 0.20; '2015': 0.20; 'stopping': 0.22; 'file.': 0.22; 'trying': 0.22; 'replacing': 0.23; 'tried': 0.24; 'script': 0.25; 'example': 0.26; 'header:X-Complaints-To:1': 0.26; 'figure': 0.27; 'define': 0.27; 'fri,': 0.27; 'module.': 0.27; 'sequence': 0.27; 'skip:u 20': 0.28; 'program,': 0.29; "i'm": 0.30; 'normally': 0.30; "i'd": 0.31; 'changing': 0.34; 'channel': 0.34; 'could': 0.35; 'nov': 0.35; 'replaced': 0.35; 'but': 0.36; 'lines': 0.36; '(and': 0.36; 'actions': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'charset:us-ascii': 0.37; 'doing': 0.38; 'itself': 0.38; 'manual': 0.38; 'copying': 0.38; 'data': 0.39; 'easily': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; "you'll": 0.61; 'provide': 0.61; 'more': 0.63; 'prompt': 0.79; '>def': 0.84; 'controller,': 0.84; 'dennis': 0.91; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: adsl-108-68-178-61.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES 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:98352 On Fri, 06 Nov 2015 11:50:50 GMT, input/ldompeling@casema.nl declaimed the following: >Hi, > >I tried to define SEQUENCE with: >The script is working now, exept that I do'nt get a menu in terminal for "s" to stop. >--------------------------------------------------------------------------------- > >def SEQUENCE(): > My untested/pseudo-code DID define SEQUENCE -- but you skipped right over it when copying it into your file. (from below, before I trimmed) >> > >> > >> > (FORWARD, BACKWARD, LEFT, RIGHT) = (1, 2, 3, 4) >> > SEQUENCE = [ (BACKWARD, 2), >> > (RIGHT, 1), >> > (FORWARD, 3), >> > (LEFT, 1), >> > (FORWARD, 2) ] >> > As for a prompt for stopping -- all that was in the "advanced" pseudo-code using the threading module. You'll have to read the relevant sections of the library reference manual to figure out what it is doing (though that is a very simple usage -- normally I'd make the main program the controller, and use Queue() to create a channel to the thread rather than using a global name). I'm not trying to produce a working program, but only to provide snippets showing alternative, more maintainable, designs. Changing the actions of the "robot" in your linear design would require replacing most of your program -- whereas my example only needs to modify SEQUENCE itself (and SEQUENCE could easily be replaced by reading lines from a data file). -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/