[Python-Dev] Simplify the file-like-object interface (Replacement for print in Python 3.0)
Steven Bethard
steven.bethard at gmail.com
Tue Sep 6 23:17:35 CEST 2005
[Greg Ewing]
> While we're on the subject, in Py3k I'd like to see
> readline(), readlines(), etc. removed from file objects
> and made builtin functions instead. It should only
> be necessary to implement read() and write() to get
> a file-like object having equal status with all
> others.
[Fredrik Lundh]
> maybe some variation of
>
> http://www.python.org/peps/pep-0246.html
>
> combined with "default adapters" could come in handy here ?
[Paul Moore]
> That sounds like a good idea. I'm certainly getting concerned about
> the proliferation of methods that people "should" add to file-like
> objects, where read/write are the only fundamental ones needed.
>
> I can't see mixins working, as too many file-like objects are written in C...
I'd also prefer something along the lines of Fredrik's suggestion, but
I don't write enough C code to understand Paul's last point. Could
someone briefly explain why mixins wouldn't work in C code? I scanned
the Python/C API Reference Manual, but all I could find was that, for
tp_base "only single inheritance is supported; multiple inheritance
require dynamically creating a type object by calling the
metatype."[1]
[1] http://docs.python.org/api/type-structs.html#l2h-983
STeVe
--
You can wordify anything if you just verb it.
--- Bucky Katt, Get Fuzzy
More information about the Python-Dev
mailing list