[Python-Dev] PEP 461 Final? (original) (raw)
Glenn Linderman v+python at g.nevcal.com
Fri Jan 17 20:40:37 CET 2014
- Previous message: [Python-Dev] PEP 461 Final?
- Next message: [Python-Dev] PEP 461 Final?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 1/17/2014 8:49 AM, Ethan Furman wrote:
%s is restricted in what it will accept::
- input type supports Pybuffer? use it to collect the necessary bytes - input type is something else? use its bytes method; if there isn't one, raise a TypeError Examples: >>> b'%s' % b'abc' b'abc' >>> b'%s' % 3.14 Traceback (most recent call last): ... TypeError: 3.14 has no bytes method >>> b'%s' % 'hello world!' Traceback (most recent call last): ... TypeError: 'hello world' has no bytes method, perhaps you need to encode it?
If you produce a helpful error message for str (re: encoding), might it not be appropriate to produce a helpful error message for builtin number types (, perhaps you need a numeric format code?)? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20140117/1a1b8955/attachment.html>
- Previous message: [Python-Dev] PEP 461 Final?
- Next message: [Python-Dev] PEP 461 Final?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]