Simon Willison’s Weblog

Subscribe

2 items tagged “commandlines”

2009

Perl 6: The MAIN sub (via) “Calling subs and running a typical Unix program from the command line is visually very similar: you can have positional, optional and named arguments.”—that’s exactly what I was thinking when I came up with optfunc.

# 28th May 2009, 9:32 pm / commandlines, optfunc, perl, perl6, python, unix

optfunc. Command line parsing libraries in Python such as optparse frustrate me because I can never remember how to use them without consulting the manual. optfunc is a new experimental interface to optparse which works by introspecting a function definition (including its arguments and their default values) and using that to construct a command line argument parser. Feedback and suggestions welcome!

# 28th May 2009, 7:38 pm / commandlines, github, introspection, optfunc, optparse, projects, python