mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
SF bug 433228: repr(list) woes when len(list) big.
Gave Python linear-time repr() implementations for dicts, lists, strings. This means, e.g., that repr(range(50000)) is no longer 50x slower than pprint.pprint() in 2.2 <wink>. I don't consider this a bugfix candidate, as it's a performance boost. Added _PyString_Join() to the internal string API. If we want that in the public API, fine, but then it requires runtime error checks instead of asserts.
This commit is contained in:
parent
239508cd10
commit
a7259597f1
5 changed files with 193 additions and 56 deletions
|
@ -77,6 +77,10 @@ extern DL_IMPORT(void) _Py_ReleaseInternedStrings(void);
|
|||
#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval)
|
||||
#define PyString_GET_SIZE(op) (((PyStringObject *)(op))->ob_size)
|
||||
|
||||
/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*,
|
||||
x must be an iterable object. */
|
||||
extern DL_IMPORT(PyObject *) _PyString_Join(PyObject *sep, PyObject *x);
|
||||
|
||||
/* --- Generic Codecs ----------------------------------------------------- */
|
||||
|
||||
/* Create an object by decoding the encoded string s of the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue