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

Chris Angelico rosuav at gmail.com
Wed Dec 2 06:02:06 EST 2015


On Wed, Dec 2, 2015 at 9:48 PM, Peter Otten <__peter__ at 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



More information about the Python-list mailing list