[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

Serhiy Storchaka report at bugs.python.org
Wed Aug 14 15:48:25 CEST 2013


Serhiy Storchaka added the comment:

We can just remove "if typ is str:" case at all. A general case works for strings.

But for performance (this will slowdown Antoine's tests by 15-20%) we should left it and may be even extend it to other builtin types:

builtin_type = (str, int, float, NoneType, list, tuple, dict, set, bytes): # or may be use a set?
...
    if typ in builtin_type:
        return repr(object), True, False

----------

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


More information about the Python-bugs-list mailing list