Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Error in optparse documentation

Reply
Thread Tools

Error in optparse documentation

 
 
Shatadal
Guest
Posts: n/a
 
      05-27-2007
In the python documentation section 14.3.2.6 (http://docs.python.org/
lib/optparse-generating-help.html) in the last line it is written

"options that have a default value can include %default in the help
string--optparse will replace it with str() of the option's default
value. If an option has no default value (or the default value is
None), %default expands to none."

However this is true only for python 2.4 and newer and not for older
versions. Though the documentation for optparse (section 14.3,
http://docs.python.org/lib/module-optparse.html) says that the module
is new for python 2.3, in this version a help string (default value =
intermediate) e.g.

help="interaction mode: novice, intermediate, or expert [default:
%default]"

prints

interaction mode: novice, intermediate, or expert [default: %default]

and not:

interaction mode: novice, intermediate, or expert [default:
intermediate]

Only in python 2.4 and newer do you see the help string print as

interaction mode: novice, intermediate, or expert [default:
intermediate]

I think the documentation should be modified so that it is made clear
that %default in the help string behaves as is claimed only in version
2.4 and higher.


O.S. used is RHEL 9

 
Reply With Quote
 
 
 
 
Steven Bethard
Guest
Posts: n/a
 
      05-27-2007
Shatadal wrote:
> In the python documentation section 14.3.2.6 (http://docs.python.org/
> lib/optparse-generating-help.html) in the last line it is written
>
> "options that have a default value can include %default in the help
> string--optparse will replace it with str() of the option's default
> value. If an option has no default value (or the default value is
> None), %default expands to none."
>
> However this is true only for python 2.4 and newer and not for older
> versions.


The optparse module is externally maintained. You should file a
documentation bug at http://optik.sourceforge.net/

STeVe
 
Reply With Quote
 
 
 
 
John Machin
Guest
Posts: n/a
 
      05-27-2007
On May 28, 7:54 am, Shatadal <(E-Mail Removed)> wrote:
> In the python documentation section 14.3.2.6 (http://docs.python.org/
> lib/optparse-generating-help.html) in the last line it is written
>
> "options that have a default value can include %default in the help
> string--optparse will replace it with str() of the option's default
> value. If an option has no default value (or the default value is
> None), %default expands to none."
>
> However this is true only for python 2.4 and newer and not for older
> versions. Though the documentation for optparse (section 14.3,http://docs.python.org/lib/module-optparse.html) says that the module
> is new for python 2.3, in this version a help string (default value =
> intermediate) e.g.
>
> help="interaction mode: novice, intermediate, or expert [default:
> %default]"
>
> prints
>
> interaction mode: novice, intermediate, or expert [default: %default]
>
> and not:
>
> interaction mode: novice, intermediate, or expert [default:
> intermediate]
>
> Only in python 2.4 and newer do you see the help string print as
>
> interaction mode: novice, intermediate, or expert [default:
> intermediate]
>
> I think the documentation should be modified so that it is made clear
> that %default in the help string behaves as is claimed only in version
> 2.4 and higher.


Don't think, act; submit a doc patch: """
Please add the text "New in version 2.4." to the end of the last
bullet point in [the section that you quoted].
"""
and move on.

If you are maintaining software that must work on an older version of
Python, you need to read the docs for that version, as well as the
current docs -- you can't [reasonably] expect a birth certificate
attached to each paragraph

 
Reply With Quote
 
Marc 'BlackJack' Rintsch
Guest
Posts: n/a
 
      05-28-2007
In <(E-Mail Removed) .com>, Shatadal
wrote:

> I think the documentation should be modified so that it is made clear
> that %default in the help string behaves as is claimed only in version
> 2.4 and higher.


Maybe something should be added for clarity but I don't think it's an
error in the docs. You are reading documentation for Python 2.5 and
expect everything in it to work in older versions too?

Pick the right documentation from http://www.python.org/doc/versions/

Ciao,
Marc 'BlackJack' Rintsch
 
Reply With Quote
 
Shatadal
Guest
Posts: n/a
 
      05-28-2007
On May 28, 2:19 am, Marc 'BlackJack' Rintsch <(E-Mail Removed)> wrote:
> In <(E-Mail Removed) .com>, Shatadal
> wrote:
>
> > I think the documentation should be modified so that it is made clear
> > that %default in the help string behaves as is claimed only in version
> > 2.4 and higher.

>
> Maybe something should be added for clarity but I don't think it's an
> error in the docs. You are reading documentation for Python 2.5 and
> expect everything in it to work in older versions too?
>
> Pick the right documentation fromhttp://www.python.org/doc/versions/


Thanks Marc. I did not know that documentation for previous versions
existed.

>
> Ciao,
> Marc 'BlackJack' Rintsch



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
converting XSD documentation to HTML documentation kev.sully@gmail.com XML 1 09-16-2006 12:09 PM
optparse.py: FutureWarning error kosuke Python 14 06-09-2005 11:18 AM
Python documentation: How about structured documentation? Looking for comments/suggestions Kenneth McDonald Python 2 05-06-2004 04:11 AM
Principles of documentation (was: Python Documentation Blows!) Cameron Laird Python 1 04-03-2004 06:54 PM
optparse documentation and/or examples Mark Wilson Ruby 1 09-04-2003 01:34 AM



Advertisments