<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello,<br>
<br>
in <br>
<a class="moz-txt-link-freetext" href="http://docs.python.org/3.4/library/argparse.html#add-help">http://docs.python.org/3.4/library/argparse.html#add-help</a><br>
<br>
The last example reads:<br>
<p>The help option is typically <tt class="docutils literal"><span
class="pre">-h/--help</span></tt>. The exception to this is
if the <tt class="docutils literal"><span class="pre">prefix_chars=</span></tt>
is specified and does not include <tt class="docutils literal"><span
class="pre">-</span></tt>, in
which case <tt class="docutils literal"><span class="pre">-h</span></tt>
and <tt class="docutils literal"><span class="pre">--help</span></tt>
are not valid options. In
this case, the first character in <tt class="docutils literal"><span
class="pre">prefix_chars</span></tt> is used to prefix
the help options:</p>
<div style="position: relative;" class="highlight-python3">
<div class="highlight"><span title="Hide the prompts and output"
style="cursor: pointer; position: absolute; top: 0px; right:
0px; border-color: rgb(170, 204, 153); border-style: solid;
border-width: 1px; color: rgb(170, 204, 153); font-family:
monospace; padding-left: 0.2em; padding-right: 0.2em;
border-radius: 0px 3px 0px 0px; text-decoration: none;"
class="copybutton">>>></span>
<pre><span style="display: inline;" class="gp">>>> </span><span class="n">parser</span> <span class="o">=</span> <span class="n">argparse</span><span class="o">.</span><span class="n">ArgumentParser</span><span class="p">(</span><span class="n">prog</span><span class="o">=</span><span class="s">'PROG'</span><span class="p">,</span> <span class="n">prefix_chars</span><span class="o">=</span><span class="s">'+/'</span><span class="p">)</span>
<span style="display: inline;" class="gp">>>> </span><span class="n">parser</span><span class="o">.</span><span class="n">print_help</span><span class="p">()</span>
<span style="display: inline;" class="go">usage: PROG [-h]</span>
<span style="display: inline;" class="go">optional arguments:</span>
<span style="display: inline;" class="go"> -h, --help show this help message and exit</span>
</pre>
</div>
</div>
This example does not show the effect.<br>
On my Ubuntu I get:<br>
<pre>% python3.2
Python 3.2.3 (default, Apr 10 2013, 05:07:54)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import argparse
>>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')
>>> parser.print_help()
usage: PROG [+h]
optional arguments:
+h, ++help show this help message and exit
>>>
</pre>
Docs of 2.7, 3.3 and 3.4 show this error, 3.2 is correct.<br>
<br>
Regards<br>
<br>
Patrick<br>
</body>
</html>