[Python-3000] PyBytes_FromObject

Guido van Rossum guido at python.org
Sun Jun 29 00:04:48 CEST 2008


On Sat, Jun 28, 2008 at 11:30 AM, Brett Cannon <brett at python.org> wrote:
> On Sat, Jun 28, 2008 at 8:33 AM, Guido van Rossum <guido at python.org> wrote:
>> Seems to make sense. Do you see many places where it would make
>> existing code shorter?

> If it could be used to get the bytes from a file object, then
> marshal.c could use it; the code calls the "read" method on file
> objects and then has to check if it got a bytearray or bytes instance
> in order to get the raw string to do its work. Otherwise the
> conversion to bytes would help by eliminating the separate bytearray
> check.

Hm, that sounds like a novelty -- I don't think the corresponding
PyString or PyUnicode (or PyBytesArray) functions do anything remotely
that clever...

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list