[getopt-sig] Argtools.py

A.T. Hofkamp a.t.hofkamp@tue.nl
Tue, 19 Feb 2002 15:27:58 +0100 (CET)


Hello all,

I noticed a SIG about argument parsing, and since I have been working in that
area to create an open object oriented solution, here is my wood for the fire:

http://se.wtb.tue.nl/~hat/argtools

The source code is there, with an extremely simple example in it.
Also, the currently existing documentation, incomplete, and with spelling and
grammatical errors.
It is still lying on my desk to finish one day (the documentation, that is)
before I submit the module to the world.

Some key-points:
- It is fully object oriented. An option is an object, as well as the option
  parser. The typical use I have in mind is that a user derives a class from
  the parser he intends to use, which he then customizes for the options he
  wants.
  (sorry if my use of 'class' and 'object' is confusing, I am used to C++, with
  a much more static view on those concepts.)

- The toolkit is supposed to be open, in the sense that users should be able to
  change/add their own option (types) and/or parsers, depending on their needs.

- The class of an option (i.e. the option-type) decides what the option
  understands. There are a number of pre-defined options, yet a user is free to
  create new (derived) option-classes for his specific idiosyncratic options.
  For example, the 'StringListOption', which keeps a list of option-arguments,
  for example, if the optiontype associated with the name 'x' is of the class
  StringListOption, the command "-x spam -x eggs" will give the option the
  value ['spam','eggs'].

I'll download the SIG archive and the other packages for closer study shortly.

Albert
-- 
Constructing a computer program is like writing a painting