Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98352
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: raw_input and break |
| Date | 2015-11-06 08:25 -0500 |
| Organization | IISS Elusive Unicorn |
| 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> |
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 | Next — Previous in thread | Find similar | Unroll 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