Spot the bug: getoptquestion.py
Chris Angelico
rosuav at gmail.com
Wed Jul 6 00:14:47 EDT 2016
On Wed, Jul 6, 2016 at 2:04 PM, Lawrence D’Oliveiro
<lawrencedo99 at gmail.com> wrote:
> On Tuesday, July 5, 2016 at 1:42:42 AM UTC+12, Chris Angelico wrote:
>
>> The getopt module is designed to match the C getopt function, which I've
>> never used; for my command-line parsing, I use argparse instead
>> (usually via some wrapper that cuts down the duplication, like clize).
>
> getopt seems so much simpler.
Look at clize:
https://github.com/Rosuav/LetMeKnow/blob/master/letmeknow.py
I just put docstrings on my functions, slap "@command" above them, and
with minimal boilerplate, I have a fully-working command line
interface. It's a wrapper around argparse.
ChrisA
More information about the Python-list
mailing list