Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111185

Re: Spot the bug: getoptquestion.py

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Spot the bug: getoptquestion.py
Date 2016-07-07 22:12 +1000
Message-ID <mailman.128.1467893565.2295.python-list@python.org> (permalink)
References (1 earlier) <a588eed6-bfac-4cc9-be4a-f6ce188247b0@googlegroups.com> <CAPTjJmqOEqcj=CvUYtD=QZ4khygAANW-iJBNne0VY0Ebo_qAPg@mail.gmail.com> <mailman.118.1467778498.2295.python-list@python.org> <577e3d66$0$5816$e4fe514c@news.xs4all.nl> <CAPTjJmoM0C_joO-0EPE-bORydZBSofTVoYwprar1bBctmOQ9cQ@mail.gmail.com>

Show all headers | View raw


On Thu, Jul 7, 2016 at 9:30 PM, Oscar <jornws0718@xs4all.nl> wrote:
> Thanks all for the input. I think it all boils down to: "If you don't
> want a space in your long_option, don't put a space in there".

Yeah, I guess, pretty much!

> Mmm... nope. I'm not going to learn a new tool and introduce an extra
> dependency just to do something as basic as getopt. But then again,
> coming from a C background, getopt feels kind of familiar. ;-)

>>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.
>
> Looks neat though!

Yes, it's a third-party dependency. (Sorry, should have mentioned
that.) You're welcome to consider that to be too much risk and/or
hassle to be worth improving on getopt, but personally, I *really*
like the simplicity of just writing docstrings that still read
perfectly well as docstrings, and having them create my argparse
configs for me. Different strokes for different horses, or something
like that.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Spot the bug: getoptquestion.py Chris Angelico <rosuav@gmail.com> - 2016-07-04 21:36 +1000
  Re: Spot the bug: getoptquestion.py jornws0718@xs4all.nl (Oscar) - 2016-07-04 12:38 +0000
    Re: Spot the bug: getoptquestion.py Chris Angelico <rosuav@gmail.com> - 2016-07-04 23:42 +1000
      Re: Spot the bug: getoptquestion.py Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-05 21:04 -0700
        Re: Spot the bug: getoptquestion.py Chris Angelico <rosuav@gmail.com> - 2016-07-06 14:14 +1000
          Re: Spot the bug: getoptquestion.py jornws0718@xs4all.nl (Oscar) - 2016-07-07 11:30 +0000
            Re: Spot the bug: getoptquestion.py Chris Angelico <rosuav@gmail.com> - 2016-07-07 22:12 +1000
              Re: Spot the bug: getoptquestion.py jornws0718@xs4all.nl (Oscar) - 2016-07-07 12:29 +0000
            Re: Spot the bug: getoptquestion.py Steven D'Aprano <steve@pearwood.info> - 2016-07-26 11:12 +1000

csiph-web