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


Groups > comp.lang.python > #105879

Re: List of Functions

From Erik <python@lucidity.plus.com>
Newsgroups comp.lang.python
Subject Re: List of Functions
Date 2016-03-28 00:10 +0100
Message-ID <mailman.98.1459120211.28225.python-list@python.org> (permalink)
References <3c44f0f8-d701-463e-bf2c-f5871c51bddf@googlegroups.com>

Show all headers | View raw


Hi Richard,

On 27/03/16 20:38, Richard Riehle wrote:
> I realize that this seems trivial to many experience Pythonistas.  But it might prove useful for those who are relative newcomers

Thanks for sharing your solution (people finding the original question 
because it happens to match their own may then find this follow-up).

However, please also read PEP8 -

https://www.python.org/dev/peps/pep-0008/

>>>> def button1(number):
> 	print ('button1 = ', number)  ## define the buttons
>>>> def button2(number):
> 	print ('button2 = ', number)
>>>> def button3(number):
> 	print ('button3 = ', number)	
>>>> buttonList = [button1, button2, button3]  ## create the list
>>>>
>>>> buttonList [1] (25)          ## using positional association
> button2 =  25
>>>> buttonList [0] (number = 78)  ## using named association
> button1 = 78
>

The whitespace before the [] and () is what I'm referring you to PEP8 
about. Of course, you can do what you want - this is just a friendly 
nudge ;) That extra whitespace does make it a bit harder to grok if 
you're used to reading "typical" Python code.

BR, E.

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


Thread

List of Functions Richard Riehle <rriehle@itu.edu> - 2016-03-27 12:38 -0700
  Re: List of Functions Erik <python@lucidity.plus.com> - 2016-03-28 00:10 +0100
  Re: List of Functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-28 01:19 +0100
    Re: List of Functions Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-03-28 10:51 +0300
      Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-28 11:58 +0300
        Re: List of Functions Dan Sommers <dan@tombstonezero.net> - 2016-03-28 12:39 +0000
          Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-28 16:40 +0300
            Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 08:40 +1100
              Re: List of Functions Steven D'Aprano <steve@pearwood.info> - 2016-03-29 09:52 +1100
                Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 10:40 +1100
                Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-29 07:49 +0300
              Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-29 07:45 +0300
                Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 16:00 +1100
      Re: List of Functions Steven D'Aprano <steve@pearwood.info> - 2016-03-29 10:40 +1100
        Re: List of Functions Random832 <random832@fastmail.com> - 2016-03-28 19:50 -0400
        Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 10:54 +1100
        Re: List of Functions Rustom Mody <rustompmody@gmail.com> - 2016-03-28 19:23 -0700
        Re: List of Functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-29 03:45 +0100
          Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 14:33 +1100
          Re: List of Functions Rustom Mody <rustompmody@gmail.com> - 2016-03-28 23:21 -0700
            Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-29 09:50 +0300
            Re: List of Functions Christian Gollwitzer <auriocus@gmx.de> - 2016-03-29 08:52 +0200

csiph-web