[Python-Dev] mmap
David Beazley
beazley at cs.uchicago.edu
Wed Jun 16 21:53:23 CEST 1999
Fredrik Lundh writes:
>
> and in Python, any decent extension writer should write
> code that works with arbitrary file objects, right? "if it
> cannot deal with StringIO objects, it's broken"...
I disagree. Given that a lot of people use Python as a glue language
for interfacing with legacy codes, it is unacceptable for extensions
to be forced to use some sort of funky non-standard I/O abstraction.
Unless you are volunteering to rewrite all of these codes to use the
new I/O model, you are always going to need access (in one way or
another) to plain old 'FILE *' and integer file descriptors. Of
course, one can always just provide a function like
FILE *PyFile_AsFile(PyObject *o)
That takes an I/O object and returns a 'FILE *' where supported. (Of
course, if it's not supported, then it doesn't matter if this function
is missing since any extension that needs a 'FILE *' wouldn't work
anyways).
Cheers,
Dave
More information about the Python-Dev
mailing list