[getopt-sig] The bake-off
A.T. Hofkamp
a.t.hofkamp@tue.nl
Thu, 30 May 2002 16:28:40 +0200 (CEST)
On Thu, 30 May 2002, Greg Ward wrote:
> > or for something much more complex, like "cvs <command>
> > <command-specific-options>", Optik delivers no support, i.e. in both cases,
> > we are back to scratch "we have sys,argv, what now ?"
>
> Not true. This was discussed in detail back in Feburary; all you have
> to do is create multiple OptionParser objects, and pass each chunk of
> your command-line through them in turn. I even posted (untested,
> hypothetical) code for this.
As you then also remember, I considered your solution a hack.
It does work, but it ain't pretty....
> I don't think this is one of the Nineteen Pythonic Theses, but maybe
> there should be a Twentieth:
>
> Don't let "perfect" be the enemy of "good enough".
>
> Perfection is unattainable by us puny mortals; good enough is, well,
> good enough.
This is a nice example of a fundamental difference in opinion between us :-)
To me, "perfect" is what we aim for, and "good enough" is the result.
> > For people understanding the object-oriented concepts, argtools is the
> > smallest and most flexible (though not flexible enough to handle e.g. cvs
> > like option parsing).
>
> *splutter* but you just criticized Optik for not being able to handle a
> "sub-command" style of interface out-of-the-box!
So do it out of the box, in a non-hacked way please !
(i.e. in one parser instead of having a seperate parser for the various
parts)
> Callbacks are not the standard way of extending Optik; they're just
> there for cases where you don't need to extend the core classes.
> They're not strictly necessary, but they are convenient. I imagine they
> will be especially useful for naive users who are afraid of subclassing.
>
> Extensive, detailed instructions for how to extend Optik -- in the OO
> way, by subclassing Option and/or OptionParser -- are included in the
> source distribution. Several examples of what you can do by subclassing
> Optik are in the examples/ directory.
Yes, I read them (in version 1.2, that is). I found the classes to be quite
non-orthogonal, from an OO point-of-view not easy to use.
That does not mean it is impossible to extend Optik, I just find it not
very user-friendly.
But enough discussion about such issues. It is all in the archives.
The only serious candidate discussed in this SIG is your Optik.
Albert
--
Unlike popular belief, the .doc format is not an open publically available format.