[issue5247] Unhelpful error message with str.format()

2009-02-20 Thread Eric Smith
Eric Smith added the comment: Committed in: r69806 (trunk) r69807 (release26-maint) r69808 (py3k) r69809 (release30-maint) -- resolution: -> accepted stage: -> committed/rejected status: open -> closed ___ Python tracker

[issue5247] Unhelpful error message with str.format()

2009-02-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: Looks good to me. I don't think you need to write a specific test for this. ___ Python tracker ___ ___ Python

[issue5247] Unhelpful error message with str.format()

2009-02-20 Thread Eric Smith
Eric Smith added the comment: I'm getting ready to commit this. Does it need a test? I poked around and didn't see any tests that validate exception text, but maybe there are some I missed. I tend to think it shouldn't have a test, but I'm not sure what the norm is.

[issue5247] Unhelpful error message with str.format()

2009-02-15 Thread Eric Smith
Eric Smith added the comment: With this patch, I changed it to "format code", and made it more in line with Antoine's original suggested message. I'm okay with "format code" or "formatting code", but if we do use either of those wordings, we should change the documentation to match. Not sure if

[issue5247] Unhelpful error message with str.format()

2009-02-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Any suggestions for clearer wording? Use "formatting code" rather than "presentation type"? ___ Python tracker ___ ___

[issue5247] Unhelpful error message with str.format()

2009-02-15 Thread Eric Smith
Eric Smith added the comment: The attached patch (against trunk) changes the message. However, it has at least one unintended consequence. If you have an object with no __format__, it gets converted to a string, which is then formatted. So you get: >>> '{0:^10}'.format(0j) '0j' >>> '{0

[issue5247] Unhelpful error message with str.format()

2009-02-15 Thread Eric Smith
Eric Smith added the comment: I've gone back and read PEP 3101. To use its terminology, I think the error message should be something like: Unknown presentation type %c for type %s. I'm not sure where I got the original wording "conversion type". It's true that it's sometimes used for type conv

[issue5247] Unhelpful error message with str.format()

2009-02-13 Thread Eric Smith
Changes by Eric Smith : -- assignee: -> eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue5247] Unhelpful error message with str.format()

2009-02-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: Seems like a reasonable backport. -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-lis

[issue5247] Unhelpful error message with str.format()

2009-02-13 Thread Eric Smith
Eric Smith added the comment: I agree. I'm not sure on backporting this. I'll work on a patch. ___ Python tracker ___ ___ Python-bugs-list mai

[issue5247] Unhelpful error message with str.format()

2009-02-13 Thread Benjamin Peterson
Changes by Benjamin Peterson : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue5247] Unhelpful error message with str.format()

2009-02-13 Thread David W. Lambert
Changes by David W. Lambert : -- nosy: +LambertDW ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue5247] Unhelpful error message with str.format()

2009-02-13 Thread Antoine Pitrou
New submission from Antoine Pitrou : >>> "{0:f}".format(2.5) '2.50' >>> "{0:f}".format("spam") Traceback (most recent call last): File "", line 1, in ValueError: Unknown conversion type f The error message should mention the type of the argument that doesn't support the given conversion t