Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81789
| Path | csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!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.019 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'scripts': 0.03; 'linux,': 0.07; 'skip:/ 10': 0.09; 'subject:How': 0.10; 'cc:addr:python- list': 0.11; 'systems.': 0.12; 'chained': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'script,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'load': 0.23; 'skip:` 20': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'somewhere': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'dec': 0.30; 'specified': 0.30; 'message-id:@mail.gmail.com': 0.30; 'subject:some': 0.31; 'though.': 0.31; '(e.g.': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'rather': 0.38; 'great': 0.65; 'levels': 0.65; '11:45': 0.84; 'act.': 0.84; 'ethan': 0.84; 'furman': 0.84; 'trick,': 0.84; '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=CfhKk8L42pxGaFrCWCEY2up39lSd+fSG6P0OF6rwGi4=; b=o1RHXPOOVDO5xSwkIaC+5plMrQQdqH3qWYPQE/7Kp7ww0L02X5XrxQIincF0woNPp2 cnL1lJNkG7rbhHTXyHgXsMW3I2ei39gKbGy+iI9OtV9AAozj2ehAQyW6CutEUWintMpC mXnx4Wm314HH8uR3csvM7+2muOOrw1dr89Y2dV6XvNz7nzMvmqEFgMATSa6EbLKk7YKT dNF3UW+iEpPecewNZcxQaU53PXK0EPATyL2jeWPOVjyW2pu9rYKuC0NsDKqnwogbgiWm MaSSeJLCR9dwsqy/8PcLYkSWF4LhLAeuLw6TGUZTxh0EM5g9zDKdxB5T0is4jvbV4XlV iaPQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.152.104 with SMTP id ux8mr49200132igb.14.1417482922231; Mon, 01 Dec 2014 17:15:22 -0800 (PST) |
| In-Reply-To | <547D0B8F.1090906@stoneleaf.us> |
| References | <71b9a111-283f-4006-bc9d-e35782d9888c@googlegroups.com> <CAPM-O+yukMKq8m1Udcw23=kgPc6zvncfS1ohPcyme_4RXMTATg@mail.gmail.com> <CALvWhxuo8EB_FqkeUXe9nRj1CGFxrVtzw76afc21cB5=D4aZwg@mail.gmail.com> <CALwzid=i6vKUnQU1pfO3qs8H5u+_J4ff_XdkQUxt4ajN5JNYfQ@mail.gmail.com> <5464F958.4070404@stoneleaf.us> <547CF797.4030407@stoneleaf.us> <547D0B8F.1090906@stoneleaf.us> |
| Date | Tue, 2 Dec 2014 12:15:22 +1100 |
| Subject | Re: How about some syntactic sugar for " __name__ == '__main__' "? |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <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.16481.1417482930.18130.python-list@python.org> (permalink) |
| Lines | 11 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1417482930 news.xs4all.nl 2857 [2001:888:2000:d::a6]:42045 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:81789 |
Show key headers only | View raw
On Tue, Dec 2, 2014 at 11:45 AM, Ethan Furman <ethan@stoneleaf.us> wrote: > Put the above somewhere in your path (e.g. /usr/local/bin), make it executable, and then instead of shebanging your > scripts with `/usr/local/bin/python` you can use `/usr/local/bin/py_main`, which will load and execute the script, > calling script.main as its last act. Be aware that this trick (shebanging to a script rather than a binary) isn't specified by the POSIX standard. It works on Linux, but I don't know about other systems. It's a great trick, though. I once had shebangs chained something like three or four levels deep. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How about some syntactic sugar for " __name__ == '__main__' "? John Ladasky <john_ladasky@sbcglobal.net> - 2014-11-12 13:02 -0800
Re: How about some syntactic sugar for " __name__ == '__main__' "? Joel Goldstick <joel.goldstick@gmail.com> - 2014-11-12 16:07 -0500
Re: How about some syntactic sugar for " __name__ == '__main__' "? John Ladasky <john_ladasky@sbcglobal.net> - 2014-11-12 13:17 -0800
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ethan Furman <ethan@stoneleaf.us> - 2014-11-12 13:19 -0800
Re: How about some syntactic sugar for " __name__ == '__main__' "? Chris Kaynor <ckaynor@zindagigames.com> - 2014-11-12 13:33 -0800
Re: How about some syntactic sugar for " __name__ == '__main__' "? Marko Rauhamaa <marko@pacujo.net> - 2014-11-12 23:52 +0200
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-12 14:51 -0700
Re: How about some syntactic sugar for " __name__ == '__main__' "? Skip Montanaro <skip.montanaro@gmail.com> - 2014-11-12 15:55 -0600
Re: How about some syntactic sugar for " __name__ == '__main__' "? Chris Kaynor <ckaynor@zindagigames.com> - 2014-11-12 14:09 -0800
Re: How about some syntactic sugar for " __name__ == '__main__' "? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-15 22:09 +1100
Re: How about some syntactic sugar for " __name__ == '__main__' "? Marko Rauhamaa <marko@pacujo.net> - 2014-11-15 13:54 +0200
Re: How about some syntactic sugar for " __name__ == '__main__' "? Vito De Tullio <vito.detullio@gmail.com> - 2014-11-16 11:26 +0100
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-12 15:19 -0700
Re: How about some syntactic sugar for " __name__ == '__main__' "? Terry Reedy <tjreedy@udel.edu> - 2014-11-12 18:19 -0500
Re: How about some syntactic sugar for " __name__ == '__main__' "? Chris Angelico <rosuav@gmail.com> - 2014-11-13 10:26 +1100
Re: How about some syntactic sugar for " __name__ == '__main__' "? Terry Reedy <tjreedy@udel.edu> - 2014-11-12 19:35 -0500
Re: How about some syntactic sugar for " __name__ == '__main__' "? Chris Angelico <rosuav@gmail.com> - 2014-11-13 11:54 +1100
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ethan Furman <ethan@stoneleaf.us> - 2014-11-13 10:32 -0800
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-13 13:33 -0700
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ethan Furman <ethan@stoneleaf.us> - 2014-11-13 12:43 -0800
Re: How about some syntactic sugar for " __name__ == '__main__' "? Skip Montanaro <skip.montanaro@gmail.com> - 2014-11-13 14:44 -0600
Re: How about some syntactic sugar for " __name__ == '__main__' "? Skip Montanaro <skip.montanaro@gmail.com> - 2014-11-13 14:53 -0600
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-13 15:48 -0700
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-13 15:56 -0700
Re: How about some syntactic sugar for " __name__ == '__main__' "? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-15 21:52 +1100
Re: How about some syntactic sugar for " __name__ == '__main__' "? Vito De Tullio <vito.detullio@gmail.com> - 2014-11-16 11:39 +0100
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-16 10:15 -0700
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ethan Furman <ethan@stoneleaf.us> - 2014-12-01 15:19 -0800
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ethan Furman <ethan@stoneleaf.us> - 2014-12-01 16:45 -0800
Re: How about some syntactic sugar for " __name__ == '__main__' "? Chris Angelico <rosuav@gmail.com> - 2014-12-02 12:15 +1100
Re: How about some syntactic sugar for " __name__ == '__main__' "? Ethan Furman <ethan@stoneleaf.us> - 2014-12-02 02:17 -0800
csiph-web