Re: [Tutor] functions first?

2015-01-27 Thread Alex Kleider
On 2015-01-27 00:15, Alan Gauld wrote: On 27/01/15 02:04, Alex Kleider wrote: Please correct me if I am wrong, but I've assumed that it is proper to define all functions before embarking on the main body of a program. No, you can do it either way round. Top-Down or Bottom-Up as they are

Re: [Tutor] functions first?

2015-01-27 Thread Alan Gauld
On 27/01/15 02:04, Alex Kleider wrote: Please correct me if I am wrong, but I've assumed that it is proper to define all functions before embarking on the main body of a program. No, you can do it either way round. Top-Down or Bottom-Up as they are known. Usually its a muxture of both. But

Re: [Tutor] functions first?

2015-01-27 Thread Alex Kleider
On 2015-01-27 16:10, Steven D'Aprano wrote: On Tue, Jan 27, 2015 at 08:39:17AM -0800, Alex Kleider wrote: I use the docopt module to collect command line options and then configparser to read a file. Some of the values (such as a port number, for example) must then be adjusted. An example is

Re: [Tutor] functions first?

2015-01-27 Thread Alex Kleider
On 2015-01-26 22:30, Ben Finney wrote: Alex Kleider aklei...@sonic.net writes: Please correct me if I am wrong, but I've assumed that it is proper to define all functions before embarking on the main body of a program. I would say rather that as much code as possible should be in small

Re: [Tutor] functions first?

2015-01-27 Thread Steven D'Aprano
On Tue, Jan 27, 2015 at 08:39:17AM -0800, Alex Kleider wrote: I use the docopt module to collect command line options and then configparser to read a file. Some of the values (such as a port number, for example) must then be adjusted. An example is a port number which I want to convert

Re: [Tutor] functions first?

2015-01-27 Thread Steven D'Aprano
On Mon, Jan 26, 2015 at 06:04:10PM -0800, Alex Kleider wrote: Please correct me if I am wrong, but I've assumed that it is proper to define all functions before embarking on the main body of a program. I find myself breaking this rule because I want to set the default values of some named

Re: [Tutor] functions first?

2015-01-27 Thread Alex Kleider
On 2015-01-27 03:18, Steven D'Aprano wrote: On Mon, Jan 26, 2015 at 06:04:10PM -0800, Alex Kleider wrote: Please correct me if I am wrong, but I've assumed that it is proper to define all functions before embarking on the main body of a program. I find myself breaking this rule because I want

[Tutor] functions first?

2015-01-26 Thread Alex Kleider
Please correct me if I am wrong, but I've assumed that it is proper to define all functions before embarking on the main body of a program. I find myself breaking this rule because I want to set the default values of some named function parameters based on a configuration file which I have to

Re: [Tutor] functions first?

2015-01-26 Thread Ben Finney
Alex Kleider aklei...@sonic.net writes: Please correct me if I am wrong, but I've assumed that it is proper to define all functions before embarking on the main body of a program. I would say rather that as much code as possible should be in small well-defined functions, with the “main body” a