[tor-bugs] #9975 [Flashproxy]: use argparse rather than getopt
Tor Bug Tracker & Wiki
blackhole at torproject.org
Thu Nov 7 17:06:26 UTC 2013
#9975: use argparse rather than getopt
-----------------------------+--------------------------
Reporter: infinity0 | Owner: infinity0
Type: enhancement | Status: needs_review
Priority: minor | Milestone:
Component: Flashproxy | Version:
Resolution: | Keywords:
Actual Points: | Parent ID:
Points: |
-----------------------------+--------------------------
Changes (by dcf):
* status: assigned => needs_review
Comment:
Replying to [comment:7 atagar]:
> Just spotted this ticket. For what it's worth both stem and arm use
getopt using the following pattern...
>
> https://gitweb.torproject.org/arm.git/blob/HEAD:/arm/starter.py#l101
>
> Personally I like it quite a bit, but that said go with whatever you
like best. :)
Do you have a way to automatically generate `--help` output for the
options? Automatic `--help` output is the big thing for me.
I'm no fan of argparse--I think it makes a lot of wrong design decisions.
It's telling that the very first example in its documentation shows how to
sum a list of numbers, instead of a realistic use case.
[http://bugs.python.org/issue14191 This issue] is particularly baffling.
But I think argparse is okay as long as we stay away from the cleverer
parts and use it as a straightforward option parser. flashproxy has a
bunch of helper programs, with many common options shared between them,
and it was starting to become a burden to update the parser and `--help`
output in all of them at the same time.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9975#comment:8>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list