[Python-ideas] making a module callable

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Nov 24 10:19:54 CET 2013


Ben Finney wrote:
> So, definitely ‘sys.argv’ needs to continue having all command-line
> arguments, including the command name used to invoke the program.

That doesn't necessarily mean it has to be passed
along with the arguments to a __main__() function,
though. You can always extract it from sys.argv if
you need it.

Arguably it's more convenient to get it from there,
since you're most often to want it for things like
formatting error messages, which are probably not
happening right inside the main function.

-- 
Greg



More information about the Python-ideas mailing list