On Mon, Jul 15, 2002, Clark C . Evans wrote: > > My exposition was awful, sorry. Perhaps a specific (albeit contrived) > example would better reflect the intent. Suppose that I have a iterator > with one method, next(). Now suppose that I want a "mutable iterator", > one which adds the change() method. This is well and good, but the > concept of something being mutable is quite othogonal to iteration and > perhaps should have its own interface rather than using inheritance. > So, what I'm asserting is that once the inheritance "feature" is > there... people use it even though other approaches are available. On the whole, I'd say that Python is actually *less* prone to this problem (because using an object doesn't generally require inheritance, just protocol); in fact, it suffers from the obverse problem. Consider this: class C: def open(self, name, flags=None): def read(self): def write(self, value): def close(self): Can instances of C be used where a file object is expected? -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ Project Vote Smart: http://www.vote-smart.org/
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