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

String formatting example invalid #55082

Closed
doagie mannequin opened this issue Jan 9, 2011 · 4 comments
Closed

String formatting example invalid #55082

doagie mannequin opened this issue Jan 9, 2011 · 4 comments
Assignees
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@doagie
Copy link
Mannequin

doagie mannequin commented Jan 9, 2011

BPO 10873
Nosy @ericvsmith

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/ericvsmith'
closed_at = <Date 2011-01-09.13:56:45.728>
created_at = <Date 2011-01-09.12:20:38.695>
labels = ['type-bug', 'invalid', 'docs']
title = 'String formatting example invalid'
updated_at = <Date 2011-01-09.21:17:35.587>
user = 'https://bugs.python.org/doagie'

bugs.python.org fields:

activity = <Date 2011-01-09.21:17:35.587>
actor = 'eric.araujo'
assignee = 'eric.smith'
closed = True
closed_date = <Date 2011-01-09.13:56:45.728>
closer = 'eric.smith'
components = ['Documentation']
creation = <Date 2011-01-09.12:20:38.695>
creator = 'doagie'
dependencies = []
files = []
hgrepos = []
issue_num = 10873
keywords = []
message_count = 4.0
messages = ['125838', '125842', '125843', '125864']
nosy_count = 4.0
nosy_names = ['eric.smith', 'SilentGhost', 'docs@python', 'doagie']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue10873'
versions = ['Python 2.7']

@doagie
Copy link
Mannequin Author

doagie mannequin commented Jan 9, 2011

Your example on page http://docs.python.org/tutorial/inputoutput.html is outdated and won't work in Python 2.7:

Basic usage of the str.format() method looks like this:

>>> print 'We are the {} who say "{}!"'.format('knights', 'Ni')
We are the knights who say "Ni!"

Now, all brackets have to have a numeric or keyword argument.

@doagie doagie mannequin assigned docspython Jan 9, 2011
@doagie doagie mannequin added docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error labels Jan 9, 2011
@SilentGhost
Copy link
Mannequin

SilentGhost mannequin commented Jan 9, 2011

Works as advertised for me. Unless more information is added, it looks like an invalid issue.

@ericvsmith
Copy link
Member

This feature was added in 2.7 (and 3.1, I think). If the numeric indices are not specified, they take the args in order.

@doagie
Copy link
Mannequin Author

doagie mannequin commented Jan 9, 2011

Yes, apologies (I was using 2.6).

On Jan 9, 2011 5:52 AM, "SilentGhost" <report@bugs.python.org> wrote:

SilentGhost <ghost.adh@gmail.com> added the comment:

Works as advertised for me. Unless more information is added, it looks like
an invalid issue.

----------
nosy: +SilentGhost

_______________________________________ Python tracker <
report@bugs.python.org> <http://bugs.python...

@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 type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant