Alex Martelli <aleax@aleax.it>: > the file object's is the only example of "fat interface" problem > in Python -- an interface that exposes a lot of methods, with many > objects claiming they implement that interface but actually lying Maybe the existing file object should be split up into some number of other objects with smaller interfaces. For example, instead of the file object actually accessing an OS file itself, it could just be a wrapper around an underlying "bytestream" object, which implements only read() and write(). Then, instead of implementing your own file-like object, you would implement a new bytestream object instead, and wrap it in a standard file object. That would give you all the flavours of access automatically without having to implement them yourself and without lying about anything. Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
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