Am 31.08.12 03:43, schrieb Gregory P. Smith:
We have use for _PyBytes_Join in an extension module but technically it isn't a public Python C API... anyone know why?
API minimalism. No API should be public unless somebody can demonstrate an actual use case. The Unicode API of Python 2.0 had a serious mistake in making dozens of functions public in the API. This broke twice in Python's history: once when UCS-4 became supported, and again for PEP 393. For the former, a work-around was possible by introducing macros, to support API compatibility while breaking ABI compatibility. For PEP 393, huge efforts were necessary to even preserve the API (and this only worked with limitations). So by default, all new functions should be internal API (static if possible), until somebody has explicitly considered use cases and considered what kind of stability can be guaranteed for the API. > Looking up the bytes 'join' method and using the C API to call that > method object with proper parameters seems like overkill in the case > where we're not dealing with user supplied byte strings at all. It's not really that difficult. Instead of r = PyBytes_Join(sep, x); you write r = PyObject_CallMethod(sep, "join", "O", x); This is just a few more letters to type. Or are you concerned with the runtime overhead that this causes? Don't be: the cost of actually joining is much higher than the cost of making the call. Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com