Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

argparse: remove magic from examples #61137

Closed
guettli mannequin opened this issue Jan 11, 2013 · 8 comments
Closed

argparse: remove magic from examples #61137

guettli mannequin opened this issue Jan 11, 2013 · 8 comments
Labels
docs Documentation in the Doc dir easy

Comments

@guettli
Copy link
Mannequin

guettli mannequin commented Jan 11, 2013

BPO 16933
Nosy @terryjreedy, @cjerdonek
Files
  • issue-16933-1.patch
  • 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 = None
    closed_at = <Date 2013-01-12.03:33:15.422>
    created_at = <Date 2013-01-11.13:44:18.598>
    labels = ['easy', 'docs']
    title = 'argparse: remove magic from examples'
    updated_at = <Date 2013-07-03.19:40:33.834>
    user = 'https://bugs.python.org/guettli'

    bugs.python.org fields:

    activity = <Date 2013-07-03.19:40:33.834>
    actor = 'paul.j3'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2013-01-12.03:33:15.422>
    closer = 'chris.jerdonek'
    components = ['Documentation']
    creation = <Date 2013-01-11.13:44:18.598>
    creator = 'guettli'
    dependencies = []
    files = ['28698']
    hgrepos = []
    issue_num = 16933
    keywords = ['patch', 'easy']
    message_count = 8.0
    messages = ['179679', '179703', '179717', '179727', '179760', '179761', '179763', '192252']
    nosy_count = 8.0
    nosy_names = ['terry.reedy', 'guettli', 'bethard', 'chris.jerdonek', 'docs@python', 'python-dev', 'Ramchandra Apte', 'paul.j3']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue16933'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3', 'Python 3.4']

    @guettli
    Copy link
    Mannequin Author

    guettli mannequin commented Jan 11, 2013

    The current argparse documentation is not easy to read people new to python.

    http://docs.python.org/dev/library/argparse.html#choices

    {{{
    current: parser.add_argument('foo', choices='abc')
    }}}

    Please make this more explicit:
    {{{
    better: parser.add_argument('foo', choices=['one', 'two', 'three'])
    }}}

    {{{
    current: parser.parse_args('c'.split()) # looks like perl to me
    }}}

    {{{
    better: parser.parse_args(['c'])
    }}}

    Next: Please use a more common type, not "complex" in the choices example. It confuses a lot of people.

    @RamchandraApte
    Copy link
    Mannequin

    RamchandraApte mannequin commented Jan 11, 2013

    +1

    @cjerdonek
    Copy link
    Member

    +1. By the way, I included a couple fixes similar to these in a patch posted to bpo-16878.

    @cjerdonek
    Copy link
    Member

    Patch attached.

    @cjerdonek cjerdonek added easy docs Documentation in the Doc dir labels Jan 11, 2013
    @terryjreedy
    Copy link
    Member

    The new examples are much better and to me the patch looks ready to apply.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jan 12, 2013

    New changeset b2bb3219d36d by Chris Jerdonek in branch '2.7':
    Issue bpo-16933: Improve choices examples in argparse documentation.
    http://hg.python.org/cpython/rev/b2bb3219d36d

    New changeset eaa2a6074741 by Chris Jerdonek in branch '3.2':
    Issue bpo-16933 (2.7 forward-port): Improve choices examples in argparse docs.
    http://hg.python.org/cpython/rev/eaa2a6074741

    New changeset de9eb3031f5a by Chris Jerdonek in branch '3.3':
    Issue bpo-16933 (merge from 3.2): Improve choices examples in argparse docs.
    http://hg.python.org/cpython/rev/de9eb3031f5a

    New changeset bddbaaf332d7 by Chris Jerdonek in branch 'default':
    Issue bpo-16933 (merge from 3.3): Improve choices examples in argparse docs.
    http://hg.python.org/cpython/rev/bddbaaf332d7

    @cjerdonek
    Copy link
    Member

    Thanks for reporting the suggestion, Thomas. And thanks for looking over the patch, Terry.

    @paulj3
    Copy link
    Mannequin

    paulj3 mannequin commented Jul 3, 2013

    There still is one "choices='XYZ'" example (16.4.5.1. Sub-commands) but the focus isn't on choices.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir easy
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants