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

Chris Angelico rosuav at gmail.com
Wed Dec 11 11:41:47 CET 2013


On Wed, Dec 11, 2013 at 9:26 PM, Ben Finney <ben+python at 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



More information about the Python-list mailing list