[getopt-sig] Option package requirements

Matthias Urlichs smurf@noris.de
Sun, 24 Feb 2002 16:14:53 +0100


Hi,

Russ Cox:
> In _my_ HO, all of them are examples of bad design, and it

I am _not_ disagreeing here.

> would not be such a bad thing if the standard Python option
> parser made it very hard or impossible to emulate them.
> 
Personally I'd settle for "add some dire warnings to the documentation".

My point is that none of these options are in any way difficult to add
if the standard parser either provides for them as-is, or is structured so
that it's easy to override.

For instance, optional arguments can be done by allowing hooks for an
option-specific parse function which is allowed to mangle the argument
list; the positional non-argument stuff is easy if you allow the empty
string as an option value (which should not accept a singe "-" argument,
as that is used to specify stdin/out in some programs).

Hooks like these would allow for special requirements, while still not
explicitly supporting them, thus (at least) requiring the programmer to
THINK before implementing nonstandard stuff.

But the requirement to occasionally do non-standard processing definitely
exists, and so IMHO it should be supportable.

-- 
Matthias Urlichs     |     noris network AG     |     http://smurf.noris.de/
-- 
Don't believe everything you hear or anything you say.