[Tutor] Arguments from the command line

Steven D'Aprano steve-REMOVE-THIS at cybersource.com.au
Thu Sep 9 06:58:02 CEST 2010

On Thu, 09 Sep 2010 12:38:04 +1200, Lawrence D'Oliveiro wrote:

> In message <mailman.501.1283789339.29448.python-list at python.org>, Hugo
> Arts wrote:
>> sys.argv is a list of all arguments from the command line ...
> Interesting that Python didn’t bother to mimic the underlying POSIX
> convention of passing the command line as arguments to the mainline
> routine.

What mainline routine?

> I always felt it was more useful to have command arguments directly
> accessible as globals, rather than having to pass them from the
> mainline.


That's why we have namespaces. If you need the command line arguments, 
you just import sys and you have access to them.


More information about the Python-list mailing list