On Wed, Feb 25, 2009 at 1:03 PM, Antoine Pitrou <solip...@pitrou.net> wrote: > Guido van Rossum <guido <at> python.org> writes: >> >> Without a shared ABC you'd defeat the whole point of having ABCs. >> >> However, importing ABCs (which are defined in Python) from C code >> (especially such fundamental C code as the I/O library) is really >> subtle and best avoided. >> >> In io.py I solved this by having a Python class inherit from both the >> ABC (RawIOBase) and the implementation (_fileio._FileIO). > > My plan (let's call it "the Operation") is to define the ABCs in Python by > deriving the C concrete base classes (that is, have io.XXXIOBase derive > _io.XXXIOBase). This way, by inheriting io.XXXIOBase, user code will benefit > both from ABC inheritance and fast C concrete implementations.
However that's hardly an ABC. You need to provide a path for someone who wants to implement the ABC without inheriting your implementation. > In turn, the concrete implementations in _pyio (the Python version) would > register() those ABCs. The reason I think the Python implementations shouldn't > be involved in the default inheritance tree is that we don't want user classes > to inherit a __del__ method. > > All this is assuming I haven't made any logic error. > Otherwise, I'll have to launch "the new Operation". -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ 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