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


Groups > comp.lang.python > #111168

Re: Spot the bug: getoptquestion.py

Path csiph.com!news.bbs.geek.nz!news.mixmin.net!news.unit0.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Spot the bug: getoptquestion.py
Date Wed, 6 Jul 2016 14:14:47 +1000
Lines 19
Message-ID <mailman.118.1467778498.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> <mailman.68.1467639747.2295.python-list@python.org> <a588eed6-bfac-4cc9-be4a-f6ce188247b0@googlegroups.com> <CAPTjJmqOEqcj=CvUYtD=QZ4khygAANW-iJBNne0VY0Ebo_qAPg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de JuQzsJHmMSU/uG+1JMdtaAo2P+1VKIHrC6xdbqsZADAA==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:bug': 0.05; 'wrapper': 0.07; 'cc:addr:python-list': 0.09; 'url:github': 0.09; 'wed,': 0.15; '2016': 0.16; 'argparse': 0.16; 'boilerplate,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'url:py': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '(usually': 0.22; 'function,': 0.22; 'lawrence': 0.22; 'seems': 0.23; 'header:In-Reply-To:1': 0.24; 'module': 0.25; "i've": 0.25; 'command': 0.26; 'chris': 0.26; 'message-id:@mail.gmail.com': 0.27; 'command-line': 0.29; 'docstrings': 0.29; 'minimal': 0.30; 'received:google.com': 0.35; 'instead': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'subject:the': 0.39; 'some': 0.40; 'jul': 0.72; 'chrisa': 0.84; 'cuts': 0.84; 'duplication,': 0.84; 'url:master': 0.84; 'to:none': 0.91; 'subject:skip:g 10': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc :content-transfer-encoding; bh=NZ8rcdVO4wkJtc7KxSFrNyeJ9fQg7ix1ra9Czkza72Y=; b=skMiNU7hODmngNCcCaKHyNjG+gY9wualU3H/6/W7GOBt3H0P6Eg5g6QQDhTXCl2MXE Jm0Id6hZxTDR9HhG6eo/UA4BCgvc0xHO1++/LLphz8GtGzi5WuFY48VsWVkQR7B2gPkT OJT9kAfzhK61Abqj588wrsaYhSMjS5LbpDF7SbP335W8NXYS4f9DlDqIHfSwh740x52c P0Jxe1GKwR5FXjBOxDTLo5YlHfSBGG/jNxdm9mmiuHnzUHtoPTJbCcCb8UoKSZic3Em9 HaZji4Pn7GtdUGlKxTVX+k+vPXMto7SCnPzTSQ2GexL86Ht/FnsPhh9j+ZR1rB2oKC9i Cl6A==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc:content-transfer-encoding; bh=NZ8rcdVO4wkJtc7KxSFrNyeJ9fQg7ix1ra9Czkza72Y=; b=g0Xx4Ywm6CKKhDyLxH786qnGbYCGqqUMe4UDE9tbvrPxul16agHFKxC6LmK9vohfTO GoePIl6jRtD64ItrzU/ac82OCdHHPAfy8bCwcPYyAlIt/W++wC5soxK1hqpLdylumZQH FdGkyeUm3ZoUpjXup1iiEQh7lvIGsXnwJKU6sun70MPRI8tVY0R9MHUFrHTy/fLVXjPc 1Q2JS3fiyMQQt4/AY7cHn4vd0uA16ZzBAA6NT9EUTbjROODCkhVfY7poDFM2n7JJMZBW 8Y2jObexXpaVNnCksly7ZFBa2i+Gpl2SZeqCq0DcBVKoEaFiHotYBMXqQG1NKjzUhD2F +Rmw==
X-Gm-Message-State ALyK8tLn31zYoRRbqw7f5ravTNuo7bv4UJuwL9mq5PKFu+lLNOkuvVH1izMU8Sz/mMBuMmhnIaSDOhzVHCCJjg==
X-Received by 10.28.44.131 with SMTP id s125mr18320820wms.61.1467778488413; Tue, 05 Jul 2016 21:14:48 -0700 (PDT)
In-Reply-To <a588eed6-bfac-4cc9-be4a-f6ce188247b0@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAPTjJmqOEqcj=CvUYtD=QZ4khygAANW-iJBNne0VY0Ebo_qAPg@mail.gmail.com>
X-Mailman-Original-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> <mailman.68.1467639747.2295.python-list@python.org> <a588eed6-bfac-4cc9-be4a-f6ce188247b0@googlegroups.com>
Xref csiph.com comp.lang.python:111168

Show key headers only | View raw


On Wed, Jul 6, 2016 at 2:04 PM, Lawrence D’Oliveiro
<lawrencedo99@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

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