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


Groups > comp.lang.python > #98352

Re: raw_input and break

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
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 <mailman.85.1446816343.16136.python-list@python.org> (permalink)
References <LBW_x.37419$pB.28644@fe37.am1> <uu0%x.51136$Mw6.36660@fx03.am1>
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 <python-python-list@m.gmane.org>
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 <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>
Xref csiph.com comp.lang.python:98352

Show key headers only | View raw


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/

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


Thread

raw_input and break input/ldompeling@casema.nl - 2015-11-04 21:44 +0000
  Re: raw_input and break Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-04 14:54 -0700
  Re: raw_input and break Joel Goldstick <joel.goldstick@gmail.com> - 2015-11-04 16:56 -0500
    Re: raw_input and break input/ldompeling@casema.nl - 2015-11-04 22:37 +0000
      Re: raw_input and break Steven D'Aprano <steve@pearwood.info> - 2015-11-05 11:44 +1100
  Re: raw_input and break tian.su.yale@gmail.com - 2015-11-04 21:39 -0800
    Re: raw_input and break input/ldompeling@casema.nl - 2015-11-05 09:22 +0000
      Re: raw_input and break Peter Otten <__peter__@web.de> - 2015-11-05 11:01 +0100
        Re: raw_input and break input/ldompeling@casema.nl - 2015-11-05 10:40 +0000
          Re: raw_input and break Peter Otten <__peter__@web.de> - 2015-11-05 12:38 +0100
            Re: raw_input and break input/ldompeling@casema.nl - 2015-11-05 12:59 +0000
              Re: raw_input and break Peter Otten <__peter__@web.de> - 2015-11-05 15:16 +0100
                Re: raw_input and break input/ldompeling@casema.nl - 2015-11-05 14:34 +0000
                Re: raw_input and break Peter Otten <__peter__@web.de> - 2015-11-05 18:06 +0100
                Re: raw_input and break input/ldompeling@casema.nl - 2015-11-05 17:28 +0000
                Re: raw_input and break Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-05 20:09 -0500
                Re: raw_input and break input/ldompeling@casema.nl - 2015-11-06 05:08 +0000
                Re: raw_input and break input/ldompeling@casema.nl - 2015-11-06 11:50 +0000
                Re: raw_input and break Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-06 08:25 -0500

csiph-web