Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61588
| References | <32615c9a-b983-4399-bb55-6df6c230f247@googlegroups.com> <52A887DB.6030600@gmail.com> |
|---|---|
| Date | 2013-12-12 02:49 +1100 |
| Subject | Re: Is there any advantage to using a main() in python scripts? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3906.1386776974.18130.python-list@python.org> (permalink) |
On Thu, Dec 12, 2013 at 2:42 AM, bob gailer <bgailer@gmail.com> wrote: > It also ensures that the defining all the classes and functions happens > before referencing them (less "bookkeeping" for me). > > These two allow me to write the main program first, and follow it with all > the global stuff. I prefer define-before-use for readability, even if it doesn't matter to the language. It means that locating the source of something can be found by going upward (or starting at the top and going down - first hit should be the definition), and helps keep things organized. Obviously it's not always possible (mutual recursion, for instance), but it's a general rule of thumb that I like to maintain. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is there any advantage to using a main() in python scripts? JL <lightaiyee@gmail.com> - 2013-12-11 01:55 -0800
Re: Is there any advantage to using a main() in python scripts? Ben Finney <ben+python@benfinney.id.au> - 2013-12-11 21:26 +1100
Re: Is there any advantage to using a main() in python scripts? Chris Angelico <rosuav@gmail.com> - 2013-12-11 21:41 +1100
Re: Is there any advantage to using a main() in python scripts? marduk@letterboxes.org - 2013-12-11 07:57 -0500
Re: Is there any advantage to using a main() in python scripts? Roy Smith <roy@panix.com> - 2013-12-11 09:20 -0500
Re: Is there any advantage to using a main() in python scripts? Roy Smith <roy@panix.com> - 2013-12-11 09:17 -0500
Re: Is there any advantage to using a main() in python scripts? rusi <rustompmody@gmail.com> - 2013-12-11 06:24 -0800
Re: Is there any advantage to using a main() in python scripts? bob gailer <bgailer@gmail.com> - 2013-12-11 10:42 -0500
Re: Is there any advantage to using a main() in python scripts? Chris Angelico <rosuav@gmail.com> - 2013-12-12 02:49 +1100
Re: Is there any advantage to using a main() in python scripts? Terry Reedy <tjreedy@udel.edu> - 2013-12-11 16:22 -0500
csiph-web