Table of Contents

Class: KeywordOrBooleanArg Gnuplot/

Allow a keyword arg to be specified either as a keyword or a boolean.

This arg type is the most flexible way to allow keyword parameters to be specified. Say there is an option like fontsize that can take the values small or large. This could be represented as

KeywordOrBooleanArg(options=["small", "large"], argname="fontsize")

In that case, the fontsize could be specified in any of the following ways:

g.hardcopy(..., fontsize="small", ...) g.hardcopy(..., fontsize="large", ...) g.hardcopy(..., small=1, ...) g.hardcopy(..., large=1, ...)

If argname is set to be None, then the first two possibilities are omitted.

In the special case that there are exactly two alternatives, one can also use:

g.hardcopy(..., small=0, ...) # implies fontsize="large" g.hardcopy(..., large=0, ...) # implies fontsize="small"

Obviously care must be taken to ensure that none of the implied keyword parameter names conflict with one another or with any of the other Args allowed by a function.


a list of strings representing allowed keyword values. These options can be used as boolean values in the style option=1.
the name of the argname for the arg=value style of setting the argument. If None, then this style is not allowed.
a fixed keyword that must precede the option, or None.
the default option to set if nothing is set explicitly, or None to leave nothing set in that case.
Base Classes   
__call__ ( self,  keyw )

Errors.OptionError('Arguments %s and %s are contradictory' %( self.argname, k, ) )
Errors.OptionError('Arguments %s and %s cannot both be specified' %( option, k, ) )
Errors.OptionError('Illegal option %s=%s' %( self.argname, k, ) )
__init__ (

Table of Contents

This document was automatically generated on Sun Oct 19 17:10:22 2003 by HappyDoc version 2.1