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


Groups > comp.lang.python > #61546

Re: Is there any advantage to using a main() in python scripts?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.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.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'syntax': 0.04; 'subject:using': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'finney': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'systemexit': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'code,': 0.22; 'cc:addr:python.org': 0.22; '2.x': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'compatible': 0.32; 'except': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'ben': 0.38; 'pm,': 0.38; 'new': 0.61; 'course': 0.61; 'subject:there': 0.68; 'as:': 0.81; 'to:none': 0.92; '2013': 0.98
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=u0pkTgzhCEyNu5tQGBZwP5sLoGtbC6tpXbPCvaqsiXs=; b=YxgSfDyZegeDCBnUrolHadt9vqvO6tsLdObJ6cOkBd7aNt0pQLriJrylsJF+XNaDi1 ytBL0OlXOkeDubn2E4oLV2eO92EmduDEOz+9qxpYSe+ND7xhH3sCCJhGhq9EYizqdUyt e3FJP3J1N/UEz2epGEXUrqTXdaoxSwrGWSYjAqlAe2UWwaGC1JBRNcINYkTgek4L1x2E ACDdOIvmmnAfGXJW/PR/MBYUN7V5Azq2LIsf+uCAEd9D4fu7g7cc0/HfncTQAFRLKbuV +Ut6SxtGmCsTSZUuj47XvNBpOL6V40zKyU5R9puUom0olISliVA0cF1UsBm41Uv89AOT 1b9Q==
MIME-Version 1.0
X-Received by 10.68.111.33 with SMTP id if1mr764468pbb.31.1386758507199; Wed, 11 Dec 2013 02:41:47 -0800 (PST)
In-Reply-To <7wsitzlm3o.fsf@benfinney.id.au>
References <32615c9a-b983-4399-bb55-6df6c230f247@googlegroups.com> <7wsitzlm3o.fsf@benfinney.id.au>
Date Wed, 11 Dec 2013 21:41:47 +1100
Subject Re: Is there any advantage to using a main() in python scripts?
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.3881.1386758510.18130.python-list@python.org> (permalink)
Lines 11
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386758510 news.xs4all.nl 2971 [2001:888:2000:d::a6]:41163
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61546

Show key headers only | View raw


On Wed, Dec 11, 2013 at 9:26 PM, Ben Finney <ben+python@benfinney.id.au> wrote:
>         except SystemExit, exc:

For new code, you'd of course want to write that as:

except SystemExit as exc:

which is compatible with Python 2.6, 2.7, and 3.x, while the other
syntax is 2.x only.

ChrisA

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


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