One more thing I'd like to implement / see is the
posssibility, for an option accepting more than one
argument, to have different types for these arguments.
I.e.,
test.py --option name 3.14
I'm woking on it, but I still have to find a solution
which is:
- elegant
- backwards compatible
- possibly, not too intrusive
Any idea?
Logged In: YES
user_id=526376
OK, I've managed to have an option accept arguments of
different types.
The main modifications to the Option class are
a new type "tuple",
a new atrribute 'types'=("string", "float") (or whatever).
If one sets 'type'=("string", "float") the adjustament to
the above scheme is done automatically.
I'm still uncertain with respect to 'nargs', ie. the example
above shoud set 'nargs'=2 (as it consumes 2 arguments) or
'narg'=1 (as it outputs a single tuple) ?
Right now, it does 'nargs'=2, and doesnt accept any other
'nargs' value.
Commments?
Simplest implementation is attaceh, as a patch against 1.5a1
CVS.