[issue28385] Bytes objects should reject all formatting codes with an error message

R. David Murray report at bugs.python.org
Fri Oct 7 11:44:20 EDT 2016


R. David Murray added the comment:

Bytes don't support formatting codes, so they are passed through to object, which doesn't support any formatting codes, and produces the error message you see.  Since all other built in types reject invalid codes with a message that mentions their type, I think bytes should too.  This would change the message to:

  ValueError: Unknown format code 's' for object of type 'bytes'

Would that have lessened your confusion sufficiently?

----------
nosy: +eric.smith, r.david.murray
stage:  -> needs patch
title: Non-informative exception while formatting strings. -> Bytes objects should reject all formatting codes with an error message
type:  -> behavior

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


More information about the Python-bugs-list mailing list