[Python-Dev] User's complaints (original) (raw)
Ka-Ping Yee python-dev at zesty.ca
Thu Jul 13 09:44:41 CEST 2006
- Previous message: [Python-Dev] User's complaints
- Next message: [Python-Dev] User's complaints
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 13 Jul 2006, Wolfgang Langner wrote:
On 7/13/06, Jeroen Ruigrok van der Werven <ashemedai at gmail.com> wrote: > Things that struck me as peculiar is the old: > > if name == "main": > whatever() > > This is so out of tune with the rest of python it becomes a nuisance.
It is not beautiful but very useful. In Python 3000 we can replace it with: @main def whatever(): ... to mark this function as main function if module executed directly.
Why not simply:
def __main__():
...
or even pass in the command-line arguments:
def __main__(*args):
...
Having to 'import sys' to get at the command-line arguments always seemed awkward to me. 'import sys' feels like it should be a privileged operation (access to interpreter internals), and getting the command-line args isn't privileged.
-- ?!ng
- Previous message: [Python-Dev] User's complaints
- Next message: [Python-Dev] User's complaints
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]