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

Confusing string formatting examples #52802

Closed
mcjeff mannequin opened this issue Apr 28, 2010 · 5 comments
Closed

Confusing string formatting examples #52802

mcjeff mannequin opened this issue Apr 28, 2010 · 5 comments
Labels
docs Documentation in the Doc dir

Comments

@mcjeff
Copy link
Mannequin

mcjeff mannequin commented Apr 28, 2010

BPO 8556
Nosy @birkenfeld, @merwok, @florentx
Files
  • stdtypes.rst.2.6.5.patch: patch to rename map key
  • stdtypes.rst.trunk.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 2010-10-17.09:19:11.748>
    created_at = <Date 2010-04-28.04:57:24.916>
    labels = ['docs']
    title = 'Confusing string formatting examples'
    updated_at = <Date 2010-10-17.09:19:11.737>
    user = 'https://bugs.python.org/mcjeff'

    bugs.python.org fields:

    activity = <Date 2010-10-17.09:19:11.737>
    actor = 'georg.brandl'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2010-10-17.09:19:11.748>
    closer = 'georg.brandl'
    components = ['Documentation']
    creation = <Date 2010-04-28.04:57:24.916>
    creator = 'mcjeff'
    dependencies = []
    files = ['17115', '17155']
    hgrepos = []
    issue_num = 8556
    keywords = ['patch']
    message_count = 5.0
    messages = ['104410', '104667', '104683', '105073', '118917']
    nosy_count = 5.0
    nosy_names = ['georg.brandl', 'eric.araujo', 'flox', 'docs@python', 'mcjeff']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue8556'
    versions = ['Python 2.7']

    @mcjeff
    Copy link
    Mannequin Author

    mcjeff mannequin commented Apr 28, 2010

    I was going through the string formatting examples this evening and noticed this:

    print '%(language)s has %(#)03d quote types.' % \
    {'language': "Python", "#": 2}

    The example uses a '#' as a map key. This is somewhat misleading as if we had simply left the parenthesis off, the '#' would have been interpreted as an alternate conversion flag. Should be updated to use a more verbose (and less confusing) dictionary key.

    @mcjeff mcjeff mannequin assigned docspython Apr 28, 2010
    @mcjeff mcjeff mannequin added the docs Documentation in the Doc dir label Apr 28, 2010
    @merwok
    Copy link
    Member

    merwok commented Apr 30, 2010

    Thanks for the suggestion. Two things:

    1. Please provide a unified diff, as explained in http://www.python.org/dev/
    2. I think “number” would be a better placeholder.

    Regards

    @mcjeff
    Copy link
    Mannequin Author

    mcjeff mannequin commented May 1, 2010

    Attaching a patch against the trunk, unified format, changed to 'number' as per suggestion.

    @merwok
    Copy link
    Member

    merwok commented May 5, 2010

    Looks good to me.

    @birkenfeld
    Copy link
    Member

    Committed in r85609.

    @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
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants