[Python-3000] New io system and binary data
Charles D Hixson
charleshixsn at earthlink.net
Sun Sep 23 20:09:25 CEST 2007
Brett Cannon wrote:
> On 9/19/07, skip at pobox.com <skip at pobox.com> wrote:
>> Guido> You can repeat that until you're blue in the face but it's not
>> Guido> going to change. Way more programs (especially simple ones) deal
>> Guido> with txet than with binary data.
>> For us Unix-heads the notion that a file is anything other than a stream of
>> bytes is rather foreign. I understand that to a large degree if you made
>> the world right for us the tail would be wagging the dog.
> I think the key thing here is that Guido said "especially simple ones"
> and the examples people are talking about are not overly simple (e.g,
> gzip, ImageMagik, etc.). That would suggest that if you want the raw
> bytes from stdin or write out to stdout that accessing the 'buffer'
> attribute you probably know what you are doing and thus accessing a
> 'buffer' attribute is probably not difficult for you. =)
The problem here seems to be that this isn't currently well documented.
I've got no objection to using the buffer attribute...but I've searched
the documentation and haven't found any references to it that don't
merely refer back to a PEP. There's one reference about "the new buffer
interface", but no further details. There's a comment in the tutorial
that says to see the library reference for more information...but there
doesn't appear to be anything in the library reference to justify that
P.S.: If opening files on Linux is now to be semantically meaningful,
then the documentation on that section also needs to change. Currently
it appears to mean that it's a meaningless specification that will be
ignored unless you happen to be using the MSWindows platform.
More information about the Python-3000