Script Discussion & Critique

hokieghal99 hokiegal99 at hotmail.com
Thu Aug 28 09:30:55 EDT 2003


Ganesan R wrote:
> Others have done an excellent job of telling you the problems of critiquing
> your code. I'll try to address one point that others haven't covered
> already.
> 
> What you've done is not wrong. But it's simpler to replace all that with 
> 
> import sys
> x = sys.argv[1]
> y = sys.argv[2]
> setpath = sys.argv[3]
> 
> so that you can run it as "python myscript.py <search> <replace> <path>".
> This way you can easily call your script from another program and
> makes it much more useful. You can do something like
> 
> if len(sys.argv) >= 1:
>     x = sys.argv[1]
>     y = sys.argv[2]
>     setpath = sys.argv[3]
> else:
>     raw_input(...)
>     ...

I don't understand this approach to developing a script. I think this is 
more of a true program than a script... it's much more complex. My 
background is shell scripting so I'm limited to what I've learned from 
that. Python is much deeper than that, but I'm learning. Thank you for 
the advice.





More information about the Python-list mailing list