How to move optparse from main to function?

Jason Drew jasondrew72 at gmail.com
Fri Feb 24 19:02:13 EST 2006


You're welcome!

As usual, each of us is free to write the code whichever way works best
for the particular problem at hand. That's why the module documentation
often avoids advocating here-is-the-one-best-way-to-do-it.  I just like
sticking all the option setup stuff in a single function because it's
conceptually all the same and it makes the main() function or whatever
read shorter. It's partly down to experience, what little of it I can
claim.

Good luck!




More information about the Python-list mailing list