Error in optparse documentation

Discussion in 'Python' started by Shatadal, May 27, 2007.

  1. Shatadal

    Shatadal Guest

    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
     
    Shatadal, May 27, 2007
    #1
    1. Advertising

  2. 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
     
    Steven Bethard, May 27, 2007
    #2
    1. Advertising

  3. Shatadal

    John Machin Guest

    On May 28, 7:54 am, 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. 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 :)
     
    John Machin, May 28, 2007
    #3
  4. In <>, 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
     
    Marc 'BlackJack' Rintsch, May 28, 2007
    #4
  5. Shatadal

    Shatadal Guest

    On May 28, 2:19 am, Marc 'BlackJack' Rintsch <> wrote:
    > In <>, 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
     
    Shatadal, May 28, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cameron Laird
    Replies:
    1
    Views:
    692
    Josiah Carlson
    Apr 3, 2004
  2. Kenneth McDonald
    Replies:
    2
    Views:
    791
  3. kosuke

    optparse.py: FutureWarning error

    kosuke, Jun 2, 2005, in forum: Python
    Replies:
    14
    Views:
    687
    John Abel
    Jun 9, 2005
  4. Replies:
    1
    Views:
    1,264
    Andy Dingley
    Sep 16, 2006
  5. Mark Wilson
    Replies:
    1
    Views:
    141
    Takashi & Kayoko Sano
    Sep 4, 2003
Loading...

Share This Page