On Wed, Feb 25, 2009 at 7:35 AM, Antoine Pitrou <solipsis at 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/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4