Re: --help option: sys.exit or return?

[email protected] Wed, 20 Oct 2004 13:19:22 +1000
Newsgroups gmane.comp.python.optik.user
Organization Lingfo Pty Ltd
Message-ID <417665DA.5984.198E5DC@localhost>
On 19 Oct 2004 at 22:35, Greg Ward wrote:

> On 20 October 2004, [email protected] said:
> > I don't understand the OP's problem or what the use case is.
> [...]
> > If you want to call your foofunc from within the interpreter, you
> > just type that in yourself, don't you? Why bother going through
> > optik?
> 
> I assume that his point was that for learning/experimenting/playing
> around, an interactive interpreter session is ideal.  I do that all
> the time when learning a new module.  I don't do that with Optik,
> since I know its capabilities and syntax pretty well.  ;-)  But I
> don't like this:
> 
>   $ python            # hmmm, this optik thing looks neat, let's
>   play... [...] >>> from optik import * >>> parser = OptionParser()
>   >>> parser.parse_args(["--help"]) usage:  [options]
> 
>   options:
>     -h, --help  show this help message and exit
>   $                    # aiee, dumped out of Python and back to the
>   shell!

IMHO, aiee nothing, it shows you *exactly* what happens. No drama. You can then 
reinvoke python and depending on what command-line history/editing tools you have, 
you can rapidly repeat previous commands.

What is the alternative -- trying to detect that you're in the interpreter, and displaying a 
message like "Had you run this in the manner for which the module is designed, it would 
have, as documented, dumped you back to the command prompt"????


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl