Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.026 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'classes,': 0.05; 'importing': 0.05; 'subject:using': 0.09; 'modules,': 0.16; 'referencing': 0.16; 'stuff.': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'first,': 0.26; 'task': 0.26; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'am,': 0.29; 'actual': 0.34; 'classes': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'two': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'to:addr:gmail.com': 0.65; 'subject:there': 0.68; 'add:': 0.84; 'me).': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=kivFLT2z6E2BOHa/IZz66h+a0lO1cgA2N1sJAiAeZ3o=; b=kbvEUCXNJMMVjH3I2eX2m9pyivG6k3Efj0NrG/ZRRiIqYFp5dicW/7ZdkbuwhmEKg0 7sGzjmBRfdUVwfuOPrrCeSC89uSCGkso1pd7S4dqGi2+wzK4QP8RpDOsApWn2dhp6xkI qgdzOuZGUTvweSyZ47Omlx1jTuXxMCq/7QfswV6JQwCxhnSMYFfdSh3V6eonwmPN5yiO Sl8JW6ji/e7csCd7RxCKAyav0U0yPDP7JxQakHen1/oN3mL/3jXJyMez3fvzjEv/fhxf HxmMAbdIdaMBm9UzKbYDlzOesLUA0W34Ri2eO44h0jVXY8UKaSa1rwWlmsWdUjAqLt+Z T+2w== X-Received: by 10.224.171.70 with SMTP id g6mr3827427qaz.80.1386776547992; Wed, 11 Dec 2013 07:42:27 -0800 (PST) Date: Wed, 11 Dec 2013 10:42:19 -0500 From: bob gailer User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: JL , python-list@python.org Subject: Re: Is there any advantage to using a main() in python scripts? References: <32615c9a-b983-4399-bb55-6df6c230f247@googlegroups.com> In-Reply-To: <32615c9a-b983-4399-bb55-6df6c230f247@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386776551 news.xs4all.nl 2958 [2001:888:2000:d::a6]:54991 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61586 On 12/11/2013 4:55 AM, JL wrote: > What is the advantage to using a main()? In addition to what's been said I add: It separates all the global activities: defining of functions and classes, importing modules, etc. from the "doing" the actual task of the program. 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.