Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / lib / optparse-option-attributes.html
CommitLineData
86530b38
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="optparse-standard-option-types.html" />
13<link rel="prev" href="optparse-standard-option-actions.html" />
14<link rel="parent" href="optparse-reference-guide.html" />
15<link rel="next" href="optparse-standard-option-types.html" />
16<meta name='aesop' content='information' />
17<title>6.21.3.5 Option attributes</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="6.21.3.4 Standard option actions"
25 href="optparse-standard-option-actions.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="6.21.3 Reference Guide"
28 href="optparse-reference-guide.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="6.21.3.6 Standard option types"
31 href="optparse-standard-option-types.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="optparse-standard-option-actions.html">6.21.3.4 Standard option actions</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="optparse-reference-guide.html">6.21.3 Reference Guide</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="optparse-standard-option-types.html">6.21.3.6 Standard option types</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H3><A NAME="SECTION0082135000000000000000"></A><A NAME="optparse-option-attributes"></A>
56<BR>
576.21.3.5 Option attributes
58</H3>
59
60<P>
61The following option attributes may be passed as keyword arguments
62to <code>parser.add_option()</code>. If you pass an option attribute
63that is not relevant to a particular option, or fail to pass a required
64option attribute, <tt class="module">optparse</tt> raises OptionError.
65
66<UL>
67<LI>
68<tt class="member">action</tt> (default: <code>"store"</code>)
69
70<P>
71Determines <tt class="module">optparse</tt>'s behaviour when this option is seen on the command
72line; the available options are documented above.
73
74<P>
75</LI>
76<LI>
77<tt class="member">type</tt> (default: <code>"string"</code>)
78
79<P>
80The argument type expected by this option (e.g., <code>"string"</code> or
81<code>"int"</code>); the available option types are documented below.
82
83<P>
84</LI>
85<LI>
86<tt class="member">dest</tt> (default: derived from option strings)
87
88<P>
89If the option's action implies writing or modifying a value somewhere,
90this tells <tt class="module">optparse</tt> where to write it: <tt class="member">dest</tt> names an attribute of the
91<code>options</code> object that <tt class="module">optparse</tt> builds as it parses the command line.
92
93<P>
94</LI>
95<LI>
96<code>default</code> (deprecated)
97
98<P>
99The value to use for this option's destination if the option is not
100seen on the command line. Deprecated; use <code>parser.set_defaults()</code>
101instead.
102
103<P>
104</LI>
105<LI>
106<code>nargs</code> (default: 1)
107
108<P>
109How many arguments of type <tt class="member">type</tt> should be consumed when this
110option is seen. If &gt; 1, <tt class="module">optparse</tt> will store a tuple of values to
111<tt class="member">dest</tt>.
112
113<P>
114</LI>
115<LI>
116<code>const</code>
117
118<P>
119For actions that store a constant value, the constant value to store.
120
121<P>
122</LI>
123<LI>
124<code>choices</code>
125
126<P>
127For options of type <code>"choice"</code>, the list of strings the user
128may choose from.
129
130<P>
131</LI>
132<LI>
133<code>callback</code>
134
135<P>
136For options with action <code>"callback"</code>, the callable to call when this
137option is seen. See section&nbsp;<A href="optparse-option-callbacks.html#optparse-option-callbacks">6.21.4</A>, Option Callbacks for detail on the arguments
138passed to <code>callable</code>.
139
140<P>
141</LI>
142<LI>
143<code>callback_args</code>, <code>callback_kwargs</code>
144
145<P>
146Additional positional and keyword arguments to pass to <code>callback</code>
147after the four standard callback arguments.
148
149<P>
150</LI>
151<LI>
152<tt class="member">help</tt>
153
154<P>
155Help text to print for this option when listing all available options
156after the user supplies a <tt class="member">help</tt> option (such as <code>"-help"</code>).
157If no help text is supplied, the option will be listed without help
158text. To hide this option, use the special value <code>SUPPRESS_HELP</code>.
159
160<P>
161</LI>
162<LI>
163<code>metavar</code> (default: derived from option strings)
164
165<P>
166Stand-in for the option argument(s) to use when printing help text.
167See section&nbsp;<A href="optparse-tutorial.html#optparse-tutorial">6.21.2</A>, the tutorial for an example.
168
169<P>
170</LI>
171</UL>
172
173<P>
174
175<DIV CLASS="navigation">
176<div class='online-navigation'>
177<p></p><hr />
178<table align="center" width="100%" cellpadding="0" cellspacing="2">
179<tr>
180<td class='online-navigation'><a rel="prev" title="6.21.3.4 Standard option actions"
181 href="optparse-standard-option-actions.html"><img src='../icons/previous.png'
182 border='0' height='32' alt='Previous Page' width='32' /></A></td>
183<td class='online-navigation'><a rel="parent" title="6.21.3 Reference Guide"
184 href="optparse-reference-guide.html"><img src='../icons/up.png'
185 border='0' height='32' alt='Up One Level' width='32' /></A></td>
186<td class='online-navigation'><a rel="next" title="6.21.3.6 Standard option types"
187 href="optparse-standard-option-types.html"><img src='../icons/next.png'
188 border='0' height='32' alt='Next Page' width='32' /></A></td>
189<td align="center" width="100%">Python Library Reference</td>
190<td class='online-navigation'><a rel="contents" title="Table of Contents"
191 href="contents.html"><img src='../icons/contents.png'
192 border='0' height='32' alt='Contents' width='32' /></A></td>
193<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
194 border='0' height='32' alt='Module Index' width='32' /></a></td>
195<td class='online-navigation'><a rel="index" title="Index"
196 href="genindex.html"><img src='../icons/index.png'
197 border='0' height='32' alt='Index' width='32' /></A></td>
198</tr></table>
199<div class='online-navigation'>
200<b class="navlabel">Previous:</b>
201<a class="sectref" rel="prev" href="optparse-standard-option-actions.html">6.21.3.4 Standard option actions</A>
202<b class="navlabel">Up:</b>
203<a class="sectref" rel="parent" href="optparse-reference-guide.html">6.21.3 Reference Guide</A>
204<b class="navlabel">Next:</b>
205<a class="sectref" rel="next" href="optparse-standard-option-types.html">6.21.3.6 Standard option types</A>
206</div>
207</div>
208<hr />
209<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
210</DIV>
211<!--End of Navigation Panel-->
212<ADDRESS>
213See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
214</ADDRESS>
215</BODY>
216</HTML>