[Tutor] File-Fetcher (cmdline-parser)
Peter Otten
__peter__ at web.de
Sat Mar 16 11:19:05 CET 2013
Christopher Emery wrote:
> Hello Peter,
>
> Thank you this is much appreciated! It is much clear now. Thank you
>
> PO: Also, if you make it a habit to keep long option and dest in sync
> (something you get for free if you only specify the option) you can
> deduce the attribute name used in the script from its commandline
> interface.
> CE: Can you please explain this deeper please? I am not sure if I am
> getting it.
Suppose a have a script doit.py that accepts a flag -f. You have not used it
for a while, then you try it again and decide you want to make a
modification related to the -f option or fix some cornercase where it
doesn't work as you expect. If the script was written by me you can run
./doit -h
to find out that the long name for -f is --enable-foo, open the sript with
an editor and search for the string args.enable_foo to find the entry point
to the code related to the -f/--enable-foo option.
It's no big deal, but I find it convenient.
More information about the Tutor
mailing list