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


Groups > comp.lang.python > #80675

Re: How about some syntactic sugar for " __name__ == '__main__' "?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'see.': 0.07; 'executable': 0.09; 'implements': 0.09; 'logic': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'ah,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'simpson': 0.16; 'wrote:': 0.18; 'app': 0.19; 'module': 0.19; 'first.': 0.19; 'thu,': 0.19; 'preferred': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; 'own,': 0.31; 'subject:some': 0.31; '(i.e.': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'nov': 0.38; 'pm,': 0.38; 'details': 0.65; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=/uzJXzwBpXLWXPXEeenzNs1s/7k0/llSH9+oHVyfNyk=; b=UWOTGso9lp/8e4kpAPp/9CXGOIx7W/Il0uq9no7YZsqHgXG5TQs9sx63rG23YfY6tl prz9kloC0q8cJ08Z16yKtabbseafHvxg7EFH8wuLeqgxXPtQmHy1s/EFNmoIFVcvnoHE zRxdVRibA1hfKqmSa4xZkUuy8nxDnEk7XtVVMFLSJancjevlKbO1+gsVaB3AvOMd65xD Q9hyfuOokztzdp/P5AZI1BwxT0+UL6Kjgg0E8tLH8uNWDCzFosu/HcHagVLdLuwuxIy2 citvnx95/5jd8Ty0tMdJJthSG5WQVsX/DYQ9FdkmIjesbiYjwyU0Pmgbnc0d/+ZoPpOi XLFA==
MIME-Version 1.0
X-Received by 10.107.134.89 with SMTP id i86mr1124865iod.53.1415869136815; Thu, 13 Nov 2014 00:58:56 -0800 (PST)
In-Reply-To <20141113084725.GA97979@cskk.homeip.net>
References <CAPTjJmr9BbFQzEYzWgW+2Y_cB-kSaXZZQ0nK4Mr=TJf7i0dZXQ@mail.gmail.com> <20141113084725.GA97979@cskk.homeip.net>
Date Thu, 13 Nov 2014 19:58:56 +1100
Subject Re: How about some syntactic sugar for " __name__ == '__main__' "?
From Chris Angelico <rosuav@gmail.com>
Cc Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15769.1415869145.18130.python-list@python.org> (permalink)
Lines 9
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415869145 news.xs4all.nl 2853 [2001:888:2000:d::a6]:34544
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 3394
X-Received-Body-CRC 2213746314
Xref csiph.com comp.lang.python:80675

Show key headers only | View raw


On Thu, Nov 13, 2014 at 7:47 PM, Cameron Simpson <cs@zip.com.au> wrote:
> My view is that if there's a main (i.e. the module implements a small app
> all on its own, however tiny), then the main program logic should come
> first. The details follow later.

Ah, I see. Makes sense. It's kinda like an executable docstring. Still
not my preferred style, but makes its own sense.

ChrisA

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


Thread

Re: How about some syntactic sugar for " __name__ == '__main__' "? Chris Angelico <rosuav@gmail.com> - 2014-11-13 19:58 +1100
  Re: How about some syntactic sugar for " __name__ == '__main__' "? Roy Smith <roy@panix.com> - 2014-11-13 08:33 -0500
    Re: How about some syntactic sugar for " __name__ == '__main__' "? Chris Angelico <rosuav@gmail.com> - 2014-11-14 00:40 +1100

csiph-web