Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Manolo =?iso-8859-1?Q?Mart=EDnez?= Newsgroups: comp.lang.python Subject: Re: Is vars() the most useless Python built-in ever? Date: Wed, 2 Dec 2015 10:40:33 +0100 Lines: 20 Message-ID: References: <565cf141$0$1612$c3e8da3$5496439d@news.astraweb.com> <20151201084416.GA2700@beagle> <20151201213100.GA9665@beagle.localdomain> <20151202090954.GC9665@beagle.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de aEXg7267cJ0m1rHvdAYcaA/tQmvI353QF/FPvQseOcMw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'subject:Python': 0.05; 'main()': 0.07; 'wrapper': 0.07; 'cc:addr :python-list': 0.09; 'libraries.': 0.09; 'url:github': 0.09; 'example:': 0.10; 'anyway': 0.11; 'wed,': 0.15; 'things.': 0.15; 'argparse': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:ever': 0.16; 'subject:most': 0.16; 'url:py': 0.16; 'wrote:': 0.16; 'library': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'wrote': 0.23; 'dec': 0.23; 'header :In-Reply-To:1': 0.24; 'install': 0.25; "i've": 0.25; 'header :User-Agent:1': 0.26; 'chris': 0.26; 'define': 0.27; 'function': 0.28; 'looks': 0.29; 'asks': 0.29; 'idea,': 0.29; 'pointer.': 0.29; 'seemingly': 0.29; 'url:python': 0.33; 'true.': 0.33; 'similar': 0.33; 'could': 0.35; 'but': 0.36; 'project': 0.36; 'url:org': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'wrong': 0.38; 'does': 0.39; 'subject:the': 0.39; 'subject:-': 0.39; 'user,': 0.67; 'directly.': 0.76; 'clize': 0.84; 'docstrings.': 0.84; 'received:82.223': 0.84; 'this...': 0.84; 'url:clize': 0.84; 'url:master': 0.84; 'to:none': 0.91 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99862 On 12/02/15 at 08:33pm, Chris Angelico wrote: > On Wed, Dec 2, 2015 at 8:09 PM, Manolo Martínez > > This... is true. I could have sworn that's not the way argparse behaved > > when I wrote that snippet, but I've been very wrong before about similar > > things. Anyway my main() function looks much better now :) > > I would recommend not using argparse directly. Pick up a wrapper like > clize, and then define everything through docstrings. > > Clize usage example: > https://github.com/Rosuav/LetMeKnow/blob/master/letmeknow.py > > https://pypi.python.org/pypi/clize I try to do as much as I can with standard library tools. As a user, I find it somewhat off-putting when a tiny project asks you to install any number of seemingly unrelated libraries. But clize does look like a good idea, thanks for the pointer. Manolo