Re: Re: [Python-Dev] anyone tried to use optparse with something else than sys.argv?
Greg Ward <[email protected]> Wed, 11 Dec 2002 09:05:32 -0500
| Newsgroups | gmane.comp.python.optik.user |
|---|---|
| Message-ID | <[email protected]> |
On 10 December 2002, Erik Heneryd said:
> well, i've tried to apply all those things in a patch (attached):
> can't say i fully understand optparse, it's quite complex, so i thought
> i'd post it here for comments before anything else...
First bit of bad news: the optparse.py in Python's library is
automatically generated from the Optik source, so patching optparse.py
is a waste of time. You'll need to get the Optik CVS tree from
optik.sourceforge.net and hack on that.
> the main thing i've done is that i've centralized the error handling. if
> something goes wrong, error() is not called, but an exception raised. all
> exceptions are then caught in parse_args(). there one can decide what to
> do with them - call error() or really throw an exception?
Sounds reasonable on the surface, but I'll need to look at your patch in
detail before making up my mind.
> the help and version actions no longer call methods, they too raise
> exceptions, to be caught in parse_args().
That I'm not so sure about. Hmmm.
I'm going to have to sit down with the list of problems you posted to
python-dev and come up with my own solutions. *Then* I'll understand
your solutions. We'll probably agree on some points and not on others
-- that's life.
Greg
--
Greg Ward <[email protected]> http://www.gerg.ca/
"Very funny, Scotty. Now beam my *clothes* down."
-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/