[getopt-sig] sig active or not?
holger@trillke.net
holger@trillke.net
Fri, 12 Apr 2002 15:31:32 +0200
On Fri, Apr 12, 2002 at 01:46:20PM +0100, David Boddie wrote:
> On Friday 12 Apr 2002 1:32 pm, holger@trillke.net wrote:
>
> > http://mail.python.org/pipermail/getopt-sig/2002-April/000121.html
>
> In your proposal, you wrote:
>
> > if you say "program --id 17 /etc/passwd /etc/groups"
> > your program.run function will have the following vars
> > in locals()
> >
> > quiet = None
> > verbose= None
> > id=17
> > filein='/etc/passwd'
> > morefiles=('/etc/groups')
>
> I think that this is interesting as you automatically obtain variables
> initialised to the desired values, but I can't really comment on the
> method you use.
i guess you mean the code-inspection part? That's a wide field but
i have some experience there and think its not really difficult
to do.
> How do you propose that options such as "--output-file" are represented
> as variables?
good question.
several possibilities:
1. in the current design:
def run(
outputfile=('output-file', '%s') # ...
2. or we could lazily allow to let 'outputfile', 'out-put-file' ...
to all map to the variable outputfile. The question
is whether you usually want to *prevent* a cmdline-user
from using either --outputfile or --output-file.
personally i wouldn't want to prevent that.
3. maybe a better idea is to improve the design:
def run(
outputfile=('--output-file %s', 0) # ...
which is shorter, more flexible and more precise than
the first suggestion.
what would you prefer or suggest?
holger