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


Groups > comp.lang.python > #98101

Re: GoPiGo script

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Newsgroups comp.lang.python
Subject Re: GoPiGo script
Date 2015-11-02 09:10 -0500
Organization IISS Elusive Unicorn
Message-ID <mailman.64.1446473424.4463.python-list@python.org> (permalink)
References <d9hnjqF4lbuU1@mid.individual.net> <AyJZx.1$Gy4.0@fe40.am1>

Show all headers | View raw


On Mon, 02 Nov 2015 13:29:04 GMT, input/ldompeling@casema.nl declaimed the
following:

>I tried to use def loop(): now for to restart the script.
>but its only restart "fwd()" print ("forward 1x") and then stop.

>def loop():
>    fwd()
>    print ("forward 1x")
>    time.sleep(2)
>    stop()
>
>if mindist > us_dist(15):

	Which is exactly what you told it to do. You have defined a function
containing four statements: fwd(), print(), sleep(), and stop(); after
executing the stop the function will return to where it was called -- the
end of your program.

	All of your"if" statements will be executed after "loop" is defined
(but not executed) and before the call to "loop" at the bottom. They are
NOT part of "loop". Please reread the Python language reference manual,
focusing on the part that describes indentation and block structuring.


>loop()
>

	Also, just calling something "loop" does not make it a loop. This
function will be called just one time and then the program will exit.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


Thread

GoPiGo script input/ldompeling@casema.nl - 2015-10-30 16:58 +0000
  Re: GoPiGo script Peter Pearson <pkpearson@nowhere.invalid> - 2015-10-30 17:27 +0000
    Re: GoPiGo script input/ldompeling@casema.nl - 2015-11-02 13:29 +0000
      Re: GoPiGo script hakugin.gin@gmail.com - 2015-11-02 05:45 -0800
        Re: GoPiGo script hakugin.gin@gmail.com - 2015-11-02 05:49 -0800
          Re: GoPiGo script input/ldompeling@casema.nl - 2015-11-02 14:28 +0000
            Re: GoPiGo script hakugin.gin@gmail.com - 2015-11-02 07:19 -0800
            Re: GoPiGo script MRAB <python@mrabarnett.plus.com> - 2015-11-02 15:21 +0000
              Re: GoPiGo script hakugin.gin@gmail.com - 2015-11-02 07:30 -0800
      Re: GoPiGo script Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-02 09:10 -0500
        Re: GoPiGo script input/ldompeling@casema.nl - 2015-11-02 14:32 +0000
          Re: GoPiGo script Robin Koch <robin.koch@t-online.de> - 2015-11-02 20:31 +0100
            Re: GoPiGo script Larry Hudson <orgnut@yahoo.com> - 2015-11-02 13:06 -0800
              Re: GoPiGo script Robin Koch <robin.koch@t-online.de> - 2015-11-03 01:45 +0100
  Re: GoPiGo script hakugin.gin@gmail.com - 2015-10-30 10:32 -0700
    Re: GoPiGo script input/ldompeling@casema.nl - 2015-10-30 18:18 +0000
      Re: GoPiGo script hakugin.gin@gmail.com - 2015-10-30 12:59 -0700
        Re: GoPiGo script input/ldompeling@casema.nl - 2015-10-31 10:28 +0000
          Re: GoPiGo script MRAB <python@mrabarnett.plus.com> - 2015-10-31 17:42 +0000
            Re: GoPiGo script input/ldompeling@casema.nl - 2015-10-31 18:59 +0000
              Re: GoPiGo script MRAB <python@mrabarnett.plus.com> - 2015-10-31 19:42 +0000
                Re: GoPiGo script input/ldompeling@casema.nl - 2015-10-31 20:18 +0000
                Re: GoPiGo script MRAB <python@mrabarnett.plus.com> - 2015-10-31 21:12 +0000

csiph-web