Ouch, the tutorial definitely should no longer recommend getopt (or optparse) and just stick to argparse (or sys.argv[1:] if you want simple :-). I filed newcomer-friendly issue https://bugs.python.org/issue37726.
The problem with recommending click or fire is that it doesn't look to me like any of those are category killers the way requests became years ago.
On Tue, Jul 30, 2019 at 9:07 PM Andrew Barnert via Python-ideas email@example.com wrote:
On Jul 30, 2019, at 20:49, Andrew Barnert via Python-ideas firstname.lastname@example.org wrote: >
There are lots of great third-party libraries that make turning a function into a command-line utility a lot easier than using argparse. I think whenever you want anything more than argv and don’t want argparse, you should probably just use one of those libraries.
That being said, maybe the docs should make that recommendation somewhere?
For example, just as urllib.request points you to requests if you want a higher-level HTTP client, argparse could point you to click if you want something a little more automated and/or fire if you want something dead simple for a quick&dirty script. (Not necessarily those two; those are just the ones I’m most familiar with…)
Or maybe there could be a mention in the tutorial, in the section on command-line arguments, which currently mentions getopt as the simple choice and argparse as the fancy one, but maybe it could instead mention fire, click, and argparse. (The getopt library is only really good when you’re familiar with C getopt and happen to be thinking in exactly those terms—as its own docs say up-top. So I’m not sure it’s a good idea for the tutorial to even mention it…)
Python-ideas mailing list -- email@example.com To unsubscribe send an email to firstname.lastname@example.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://email@example.com/message/OEXGSB... Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido) Pronouns: he/him/his **(why is my pronoun here?) http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...