[issue11176] give more meaningful argument names in argparse documentation
New submission from Steven Bethard
Westley Martínez
Éric Araujo
Westley Martínez
Éric Araujo
I worked on this some time ago; the problem was the size of the documentation, i.e. it was difficult to stay consistent. I think it’s okay to improve the docs one patch at a time, starting with the simple example referenced in the first message in this bug report, and gradually improving other sections. Do you have a diff with your work, so that your efforts can serve as a base for someone else?
Do I have time for this? Yes, but I wouldn't get it done anytime soon, and the results could be anywhere from good to bad. That’s why we do reviews :) It’s okay if you don’t have time, I’m interested in working on this some time in the future.
----------
assignee: docs@python -> eric.araujo
_______________________________________
Python tracker
Changes by Adam Woodbeck
Changes by Marc Sibson
Changes by Tshepang Lekhonkhobe
Greg Roodt
Éric Araujo
David Lam
Greg Roodt
David Lam
added the comment: haha wow, I was working on this bug too! maybe we can work on the final patch together
I got through about 2/3's of the docs, so I thought it might help to upload what I got so far. I basically just made stuff up so I'm totally winning to change anything (or everything)
I made a little effort to make the examples mildly amusing, since novelty sorta helps in retention. So one of the recurring examples I used involves that of a pizza-making-program... hopefully this helps in some way!
---------- nosy: +dlam Added file: http://bugs.python.org/file26325/issue11165-doc-fix-up-to-section-15.4.4.dif...
_______________________________________ Python tracker
http://bugs.python.org/issue11176 _______________________________________
----------
_______________________________________
Python tracker
Greg Roodt
David Lam
Steven Bethard
David Lam added the comment:
here's a patch that covers all but one of the foo/bar/baz examples
it also has fixes for the sample code near the beginning from the review Ezio did
the one example I didn't do was the "Arguments containing -" part. I guess it felt like changing the names in that example would distract from what it was trying to illustrate there
Anyways, I tried to proofread it so hopefully it reads okay, enjoy enjoy ^^
----------
Added file: http://bugs.python.org/file27030/issue11176.patch
_______________________________________
Python tracker
Chris Jerdonek added the comment: Also see this e-mail to docs@: http://mail.python.org/pipermail/docs/2012-December/012028.html
Subject: [docs] FOO and BAR
Do you think it would be possible to write your documentation avoiding the silly usage of FOO and BAR everywhere? This is a very very old and boring joke, and does nothing to clarify what you are trying to clarify. If you could include real-world examples in your documentation, rather than "clever" programmer "jokes", learners such as myself would have far more respect for the good work you are obviously doing here.
For example, the section on argparser is full of this sort of rubbish: argparse.ArgumentParser(description='A foo that bars')
Under what circumstances would you ever put that in a program? Are you mad?
Please take this into consideration.
----------
nosy: +chris.jerdonek
_______________________________________
Python tracker
Chris Jerdonek added the comment:
Issue 16933 improved the "choices" examples.
----------
_______________________________________
Python tracker
Westley Martínez added the comment:
I've skimmed through the patches. Good job kids. This is much better than it was before. No more of that silly command-line calculator or the foobar nonsense that sounds drier than the POSIX standard.
Is there anything else that needs to be done?
----------
_______________________________________
Python tracker
Georg Brandl added the comment:
Also see this e-mail to docs@: http://mail.python.org/pipermail/docs/2012-December/012028.html
No, please don't see this e-mail. It's not worth it. The poster clearly has no clue whatsoever about either a) common placeholders, or b) manners.
I don't want to claim that foo/bar/etc. are superior to a well-thought-out example (which takes time to come up with), but they are certainly better than no example at all.
----------
nosy: +georg.brandl
_______________________________________
Python tracker
Mark Lawrence added the comment:
If we've got some meaningful changes can we please get them committed. However I'd like to state that with over 4000 issues open we've got better things to do than change docs because somebody doesn't like the use of foo, bar and baz in examples.
----------
nosy: +BreamoreBoy
_______________________________________
Python tracker
Steve added the comment: I came here to file a bug against the argparse documentation because reading through the documentation I didn't realize a good usecase for the `epilog` argument to the `ArgumentParser()` class until I started noticing that some commandline tools end with examples of usage. I found this bug and so thought it would be better to just leave a comment here instead. I glaced through the submitted patches and noticed that the pizza making example has `epilog="Remember: select a good combination to ensure maximum tastiness` ...which while good, still might not immediately convey the usefulness of the epilog parameter (just IMHO). I think, the example would be better served by something like:
pizza_parser = argparse.ArgumentParser( ... description='Make a pizza out of ingredients and toppings', ... epilog="""Examples: Create a Python Lovers pizza using the command:: ... ./makepizz.py spam ham eggs ... """)
Of course this example would then also require passing a formatter_class argument to handle the wrapping ...but in essence the point of my comment is that the examples might be more useful if a 'real-world' usage is demonstrated.
----------
nosy: +lonetwin
_______________________________________
Python tracker
Change by Mark Lawrence
Change by Irit Katriel
participants (13)
-
Adam Woodbeck
-
Chris Jerdonek
-
David Lam
-
Georg Brandl
-
Greg Roodt
-
Irit Katriel
-
Marc Sibson
-
Mark Lawrence
-
Steve
-
Steven Bethard
-
Tshepang Lekhonkhobe
-
Westley Martínez
-
Éric Araujo