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


Groups > comp.lang.python > #66955

Re: Functions help

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Functions help
Date 2014-02-24 01:09 +0000
References <mailman.7276.1393141556.18130.python-list@python.org> <lee59o$t23$1@dont-email.me>
Newsgroups comp.lang.python
Message-ID <mailman.7297.1393204171.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 24/02/2014 00:55, alex23 wrote:
> On 23/02/2014 3:43 PM, Scott W Dunning wrote:
>> I had a question regarding functions.  Is there a way to call a
>> function multiple times without recalling it over and over.  Meaning
>> is there a way I can call a function and then add *5 or something like
>> that?
>
> The same way you repeat anything in Python: with a loop construct.
>
>      for _ in range(5):
>      func()

For the benefit of newbies, besides the obvious indentation error above, 
the underscore basically acts as a dummy variable.  I'll let the 
language lawyers give a very detailed, precise description :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

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


Thread

Functions help Scott W Dunning <swdunning@cox.net> - 2014-02-22 22:43 -0700
  Re: Functions help Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-23 08:44 +0000
  Re: Functions help alex23 <wuwei23@gmail.com> - 2014-02-24 10:55 +1000
    Re: Functions help Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-24 01:09 +0000
      Re: Functions help alex23 <wuwei23@gmail.com> - 2014-02-24 11:39 +1000
        Re: Functions help Benjamin Kaplan <benjamin.kaplan@case.edu> - 2014-02-23 18:55 -0800
          Re: Functions help Grant Edwards <invalid@invalid.invalid> - 2014-02-24 15:38 +0000
        Re: Functions help Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-24 03:21 +0000
          Re: Functions help rurpy@yahoo.com - 2014-02-23 20:01 -0800
            Re: Functions help Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-24 13:59 +0000
            Re: Functions help Ethan Furman <ethan@stoneleaf.us> - 2014-02-25 18:52 -0800
              Re: Functions help rurpy@yahoo.com - 2014-02-26 17:06 -0800
        Re: Functions help MRAB <python@mrabarnett.plus.com> - 2014-02-24 03:36 +0000
      Re: Functions help Scott W Dunning <swdunning@cox.net> - 2014-02-23 18:43 -0700
      Re: Functions help Roy Smith <roy@panix.com> - 2014-02-23 20:28 -0500
    Re: Functions help Travis Griggs <travisgriggs@gmail.com> - 2014-02-23 17:27 -0800
  Re: Functions help "Rhodri James" <rhodri@wildebst.org.uk> - 2014-02-24 01:01 +0000
    Re: Functions help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-24 21:18 -0500
      Re: Functions help "Rhodri James" <rhodri@wildebst.org.uk> - 2014-02-27 22:49 +0000
  Re: Functions help Scott W Dunning <swdunning@cox.net> - 2014-02-23 18:24 -0700
  Re: Functions help sffjunkie@gmail.com - 2014-02-24 02:15 -0800
  Re: Functions help sffjunkie@gmail.com - 2014-02-24 02:32 -0800

csiph-web