I am originally a C programmer. I have seen numerous tricks and \"hacks\" to read many different arguments.
What are some of the ways Python programmers can do this
I use optparse myself, but really like the direction Simon Willison is taking with his recently introduced optfunc library. It works by:
"introspecting a function definition (including its arguments and their default values) and using that to construct a command line argument parser."
So, for example, this function definition:
def geocode(s, api_key='', geocoder='google', list_geocoders=False):
is turned into this optparse help text:
Options:
-h, --help show this help message and exit
-l, --list-geocoders
-a API_KEY, --api-key=API_KEY
-g GEOCODER, --geocoder=GEOCODER