Re: Option specified on command line or not.

Greg Ward <[email protected]> Thu, 20 Nov 2003 22:03:31 -0500
Newsgroups gmane.comp.python.optik.user
Message-ID <[email protected]>
On 20 November 2003, Murtaza & Zainab Hakim said:
> Is it possible to find out if an option has been specified by the user on 
> the command line and not be dependent on the default value being set for 
> finding out this information. That is, can I query some class to determine 
> if the parser has in-fact hit the option on the command line?

I don't think so.  IMHO it's best to use a 'store_true' option for this
sort of thing: if the user specified the option, the corresponding value
is true.  If you don't want that, try a callback.

BTW, Optik guarantees that every option value is at least set to None --
it's only necessary to specify default values if you want something
*other* than None.  (Although I don't recall how 'append' options work
offhand -- they might default to the empty list.)

        Greg
-- 
Greg Ward <[email protected]>                         http://www.gerg.ca/
I'm a lumberjack and I'm OK / I sleep all night and I work all day


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/