Pythonic/idiomatic?
Martin Gregorie
martin at address-in-sig.invalid
Tue Nov 9 19:28:25 EST 2010
On Wed, 10 Nov 2010 00:11:23 +0000, Seebs wrote:
> On 2010-11-09, Jean-Michel Pichavant <jeanmichel at sequans.com> wrote:
>> One pythonic way to do it, is to use an option parser.
>
> That seems like massive overkill -- I don't care about any of the other
> options. It seems like it'd result in doing more work to get and then
> extract the options, and most of that would be discarded instnatly.
>
I've always used an extended version of getopt() in C. I was so surprised
to see that there's nothing equivalent in Java that I wrote my own and
was consequently was very pleased to find that Python already has the
optparse module. Using it is a no-brainer, particularly as it makes quite
a good fist of being self-documenting and of spitting out a nicely
formatted chunk of help text when asked to do so.
--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
More information about the Python-list
mailing list