Skip to content

optparse doex not export make_option #49440

Closed

Description

@bluebird75
mannequin
BPO 5190
Nosy @birkenfeld, @bluebird75

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/birkenfeld'
closed_at = <Date 2009-03-31.19:12:40.348>
created_at = <Date 2009-02-09.13:23:11.533>
labels = ['type-bug', 'library', 'docs']
title = 'optparse doex not export make_option'
updated_at = <Date 2009-03-31.19:12:40.347>
user = 'https://github.com/bluebird75'

bugs.python.org fields:

activity = <Date 2009-03-31.19:12:40.347>
actor = 'georg.brandl'
assignee = 'georg.brandl'
closed = True
closed_date = <Date 2009-03-31.19:12:40.348>
closer = 'georg.brandl'
components = ['Documentation', 'Library (Lib)']
creation = <Date 2009-02-09.13:23:11.533>
creator = 'bluebird'
dependencies = []
files = []
hgrepos = []
issue_num = 5190
keywords = []
message_count = 2.0
messages = ['81456', '84870']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'bluebird']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue5190'
versions = ['Python 2.6', 'Python 2.5']

Activity

  1. bluebird75 commented on Feb 9, 2009

    bluebird75mannequin
    MannequinAuthor

    The documentation of optparse mentions make_option() as the standard way
    to create an option list:

    For example, in the doc of python 2.5:

    ====
    14.3.3.2 Populating the parser

    [...]
    pass it an Option instance (as returned by make_option())

    [...]

    option_list = [
        make_option("-f", "--filename",
                    action="store", type="string", dest="filename"),
        make_option("-q", "--quiet",
                    action="store_false", dest="verbose"),
        ]

    (make_option() is a factory function for creating Option instances;
    currently it is an alias for the Option constructor. A future version of
    optparse may split Option into several classes, and make_option() will
    pick the right class to instantiate. Do not instantiate Option
    directly.)
    ===============

    However, make_option is not part of the function exported in the __all__
    list of optparse. Strangely enough, this does not prevent to use
    make_option() in regular python scripts, but it does not work when
    packaging a python application, for example with pyinstaller.

    The problem is also present in python 2.6

    The fix is either to update the documentation to use Option() directly
    or to add make_option to __all__

  2. added
    docs
    stdlib
    type-bug
    on Feb 9, 2009
  3. birkenfeld commented on Mar 31, 2009

    @birkenfeld
    Member

    As commented in optparse.py, make_option is the preferred way to create
    options, so I've added it to __all__ in r70868.

  4. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

docsstdlibtype-bug

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions