[issue13538] Docstring of str() and/or behavior

R. David Murray report at bugs.python.org
Tue Dec 6 14:12:17 CET 2011


R. David Murray <rdmurray at bitdance.com> added the comment:

I agree with you that this is inconsistent.  However, having str raise an error is pretty much a non-starter as a suggestion.  str always falls back to the repr; in general str(obj) should always return some value, otherwise the assumptions of a *lot* of Python code would be broken.

Personally I'm not at all sure why str takes encoding and errors arguments (I never use them). I'd rather there be only one way to do that, decode.  In other words, why do we have special case support for byte strings in the str conversion function?

But I don't think that can be changed either, so I think we are stuck with documenting the existing situation better.  Do you want to propose a doc patch?

----------
assignee:  -> docs at python
components: +Documentation -Interpreter Core
nosy: +docs at python, r.david.murray
versions: +Python 3.3

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


More information about the Python-bugs-list mailing list