On Wed, Feb 25, 2009 at 7:35 AM, Antoine Pitrou <solip...@pitrou.net> wrote: > I would like to know if both IO implementations (the C one and the Python one) > should share their ABCs (IOBase, RawIOBase, etc.). It looks preferable to me > but > since I'm not very familiar with ABCs I'd like to be sure it's the good > choice. > > (of course, the *implementations* won't be shared at all. Just the virtual > inheritance information)
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). Another way to solve it would be to use the registration API for ABCs, as found in _abcoll.py (e.g. MutableSequence.register(list)). -- --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