Request for feedback on my first Python program
Aahz
aahz at pythoncraft.com
Fri May 30 09:26:11 EDT 2003
In article <slrnbdeevn.694.andrew-usenet at athena.jcn.srcf.net>,
Andrew Walkingshaw <andrew-usenet at lexical.org.uk> wrote:
>
>def main():
> if len(sys.argv) != 2:
> usage(sys.argv[0])
> f = open(sys.argv[1], "r")
This is generally a Bad Idea; your functions should be generic and
sys.argv handling should be done under "if __name__=='__main__':".
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"In many ways, it's a dull language, borrowing solid old concepts from
many other languages & styles: boring syntax, unsurprising semantics,
few automatic coercions, etc etc. But that's one of the things I like
about it." --Tim Peters on Python, 16 Sep 93
More information about the Python-list
mailing list