Fredrik Lundh wrote: > > paul wrote: > > > If we want to use a hard-coded lossless encoding, we should do so in > > repr. Rather than having us fix a dozen modules with problems like this, > > we should fix repr once and for all. > > how about allowing str and repr to actually return > unicode strings? > > or in other words: > > PyObject *res; > res = (*v->ob_type->tp_repr)(v); > if (res == NULL) > return NULL; > if (!PyString_Check(res) && !PyUnicode_Check(res)) { > PyErr_Format(PyExc_TypeError, > "__repr__ returned non-string (type %.200s)", > res->ob_type->tp_name); > Py_DECREF(res); > return NULL; > } > return res; > > (strings are strings are strings, etc) -1: This breaks code, since it is expected that PyObject_Str() returns a string object. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4