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


Groups > comp.lang.python > #99868

Re: Is vars() the most useless Python built-in ever?

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Is vars() the most useless Python built-in ever?
Date Wed, 2 Dec 2015 22:02:06 +1100
Lines 20
Message-ID <mailman.117.1449054129.14615.python-list@python.org> (permalink)
References <565cf141$0$1612$c3e8da3$5496439d@news.astraweb.com> <20151201084416.GA2700@beagle> <n3jtei$fpa$1@ger.gmane.org> <20151201213100.GA9665@beagle.localdomain> <n3l7mi$k6g$1@ger.gmane.org> <20151202090954.GC9665@beagle.localdomain> <CAPTjJmqCi2=qHaM2cLxHz2zLAEN28EADMusn40APHVS-7XRqdg@mail.gmail.com> <20151202094033.GA12749@beagle> <n3mia3$n4t$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de /yCPtyqaQCtEffe4jEjaXgJfGWTVNAPD0DSig9ppCXcQ==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:Python': 0.05; 'encoded': 0.05; 'cc:addr:python- list': 0.09; 'callable.': 0.09; 'libraries.': 0.09; 'wed,': 0.15; 'argparse': 0.16; 'collects': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:209.85.223.173': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:ever': 0.16; 'subject:most': 0.16; 'wrote:': 0.16; 'library': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'decorator': 0.22; 'function,': 0.22; 'dec': 0.23; 'slightly': 0.23; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'install': 0.25; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'developing': 0.28; 'asks': 0.29; 'idea,': 0.29; 'pointer.': 0.29; 'seemingly': 0.29; 'normally': 0.30; "i'd": 0.31; 'that,': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'functions.': 0.35; 'but': 0.36; 'project': 0.36; 'lines': 0.36; 'received:209.85': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'turn': 0.37; 'thanks': 0.37; 'received:209': 0.38; 'does': 0.39; 'subject:the': 0.39; "didn't": 0.39; 'subject:-': 0.39; 'some': 0.40; 'total': 0.62; 'per': 0.62; 'is.': 0.63; 'here': 0.66; 'user,': 0.67; 'chrisa': 0.84; 'clize': 0.84; 'otten': 0.84; 'to:none': 0.91; 'cost:': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=wb7L6ulN9CDbLKOhlnTiXXReLTEk/SNvJEzOy010GyQ=; b=GHMTpf9GKvkeyqSqLOogBaTk3TZsYGUPn2l14E9Oi5oWK9GxOG9ClEFI/IH2FzaRCz WC8kI5kCiYGyBdmI2FVC+FTEm1ylrEQPyBwqMjvgnpeqnC57o/qNdQEqV1sl2KLR146t Bi6eKHcCf6wq2O45J3+2Zn4s5mZbl6f2zpgutI8G3/vs0ARoESH9Mb57M71lekkSaEX3 1FxC8LsXHWsdfBYPSf1dJhKXecyzUhC9+sDNCX4ZVydZ2FSYbucHI70X8Jq/wIMtjXGk rGdzFssNjWiUfRtbqPlyMYS98j2ANi81s5WEopZWiNT4rY1MxrzfRZrdmzYN51sbuYxa UxPQ==
X-Received by 10.107.10.233 with SMTP id 102mr2920695iok.31.1449054127023; Wed, 02 Dec 2015 03:02:07 -0800 (PST)
In-Reply-To <n3mia3$n4t$1@ger.gmane.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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>
Xref csiph.com comp.lang.python:99868

Show key headers only | View raw


On Wed, Dec 2, 2015 at 9:48 PM, Peter Otten <__peter__@web.de> wrote:
>> 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.
>
> Same here ;)

I found out about clize by developing my own module that did the same
job - and then found that, by compromising VERY slightly on some
specifics, I could turn my usage directly to clize :)

One thing I didn't want to compromise on was the simplicity of setup
that I'd had - just slap a decorator onto every function that you want
to make into a callable. So I made my own decorator that collects up
the functions. Total cost: Three lines at the top, two at the bottom
(if name is main, clize.run), and one line per function, plus the
encoded docstring. That's a LOT cheaper than argparse normally is.

ChrisA

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


Thread

Is vars() the most useless Python built-in ever? Steven D'Aprano <steve@pearwood.info> - 2015-12-01 12:00 +1100
  Re: Is vars() the most useless Python built-in ever? Josef Pktd <josef.pktd@gmail.com> - 2015-11-30 19:45 -0800
  Re: Is vars() the most useless Python built-in ever? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-11-30 21:54 -0800
    Re: Is vars() the most useless Python built-in ever? Marko Rauhamaa <marko@pacujo.net> - 2015-12-01 09:34 +0200
      Re: Is vars() the most useless Python built-in ever? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-12-11 13:06 -0800
    Re: Is vars() the most useless Python built-in ever? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-12-01 18:55 +1100
      Re: Is vars() the most useless Python built-in ever? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-12-01 12:33 -0800
        Re: Is vars() the most useless Python built-in ever? Steven D'Aprano <steve@pearwood.info> - 2015-12-02 11:57 +1100
        Re: Is vars() the most useless Python built-in ever? Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-01 22:48 -0600
          Re: Is vars() the most useless Python built-in ever? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-12-11 14:13 -0800
            Re: Is vars() the most useless Python built-in ever? Steven D'Aprano <steve@pearwood.info> - 2015-12-12 15:44 +1100
              Re: Is vars() the most useless Python built-in ever? Chris Angelico <rosuav@gmail.com> - 2015-12-12 16:56 +1100
              Re: Is vars() the most useless Python built-in ever? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-12-14 18:33 -0800
      Re: Is vars() the most useless Python built-in ever? Ben Finney <ben+python@benfinney.id.au> - 2015-12-02 12:47 +1100
    Re: Is vars() the most useless Python built-in ever? John Gordon <gordon@panix.com> - 2015-12-01 16:56 +0000
      Re: Is vars() the most useless Python built-in ever? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-12-01 13:15 -0800
        Re: Is vars() the most useless Python built-in ever? "Albert Visser" <albert.visser@gmail.com> - 2015-12-02 19:08 +0100
    Re: Is vars() the most useless Python built-in ever? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-12-02 13:14 +1300
  Re: Is vars() the most useless Python built-in ever? eryk sun <eryksun@gmail.com> - 2015-12-01 01:22 -0600
    Re: Is vars() the most useless Python built-in ever? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-12-01 18:57 +1100
  Re: Is vars() the most useless Python built-in ever? Manolo Martínez <manolo@austrohungaro.com> - 2015-12-01 09:44 +0100
    Re: Is vars() the most useless Python built-in ever? Steven D'Aprano <steve@pearwood.info> - 2015-12-02 12:12 +1100
      Re: Is vars() the most useless Python built-in ever? Peter Otten <__peter__@web.de> - 2015-12-02 08:51 +0100
  Re: Is vars() the most useless Python built-in ever? Peter Otten <__peter__@web.de> - 2015-12-01 11:40 +0100
  Re: Is vars() the most useless Python built-in ever? Manolo Martínez <manolo@austrohungaro.com> - 2015-12-01 22:31 +0100
  Re: Is vars() the most useless Python built-in ever? Peter Otten <__peter__@web.de> - 2015-12-01 23:41 +0100
  Re: Is vars() the most useless Python built-in ever? boB Stepp <robertvstepp@gmail.com> - 2015-12-01 20:20 -0600
  Re: Is vars() the most useless Python built-in ever? wxjmfauth@gmail.com - 2015-12-01 23:46 -0800
  Re: Is vars() the most useless Python built-in ever? Serhiy Storchaka <storchaka@gmail.com> - 2015-12-02 10:22 +0200
  Re: Is vars() the most useless Python built-in ever? Manolo Martínez <manolo@austrohungaro.com> - 2015-12-02 10:09 +0100
  Re: Is vars() the most useless Python built-in ever? Chris Angelico <rosuav@gmail.com> - 2015-12-02 20:28 +1100
  Re: Is vars() the most useless Python built-in ever? Chris Angelico <rosuav@gmail.com> - 2015-12-02 20:33 +1100
  Re: Is vars() the most useless Python built-in ever? Manolo Martínez <manolo@austrohungaro.com> - 2015-12-02 10:40 +0100
  Re: Is vars() the most useless Python built-in ever? Peter Otten <__peter__@web.de> - 2015-12-02 11:48 +0100
  Re: Is vars() the most useless Python built-in ever? Chris Angelico <rosuav@gmail.com> - 2015-12-02 22:02 +1100
  Re: Is vars() the most useless Python built-in ever? eryk sun <eryksun@gmail.com> - 2015-12-02 05:34 -0600
  Re: Is vars() the most useless Python built-in ever? Serhiy Storchaka <storchaka@gmail.com> - 2015-12-04 10:42 +0200

csiph-web