Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #111073
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Spot the bug: getoptquestion.py |
| Date | 2016-07-04 23:42 +1000 |
| Message-ID | <mailman.68.1467639747.2295.python-list@python.org> (permalink) |
| References | <577a4766$0$5839$e4fe514c@news.xs4all.nl> <CAPTjJmq9SFqLFwr9U=qH2wbJMkicuYTtaXXYNDbRn79rH4j-5g@mail.gmail.com> <mailman.66.1467632176.2295.python-list@python.org> <577a58b9$0$5902$e4fe514c@news.xs4all.nl> <CAPTjJmpjELQE21n18jmW1_QV=DHd6fL_T=vW852BVFWzFvEv4A@mail.gmail.com> |
On Mon, Jul 4, 2016 at 10:38 PM, Oscar <jornws0718@xs4all.nl> wrote: > But is this not at least a bit unexpected behaviour from getopt? On one > hand, if I want to have trailing spaces in my longoptions, why not just > play along and allow them? On the other hand, a space is a delimiter on > the commandline. Does it make sense to allow it as a parameter to > getopt()? And if getopt would silently strip it, would that be a bug? > This is really the crux of the matter. Honestly, I've no idea. 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). ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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