On 2005 Jan 21, at 14:02, Nick Coghlan wrote: > Phillip's monkey-typing PEP (and his goal of making it easy to write > well behaved adapters) got me wondering about the benefits of > providing an adaptation. Adapter class that could be used to reduce > the boiler plate required when developing new adapters. Inheriting > from it wouldn't be *required* in any way - doing so would simply make > it easier to write a good adapter by eliminating or simplifying some > of the required code. Being written in Python, it could also serve as > good documentation of recommended adapter behaviour. > > For instance, it could by default preserve a reference to the original > object and use that for any further adaptation requests: > > class Adapter(object): > def __init__(self, original): > self.original = original > > def __conform__(self, protocol): > return adapt(self.original, protocol) > > Does anyone else (particularly those with PEAK and Zope interface > experience) think such a class would be beneficial in encouraging good > practices? Yes, there was something just like that in Nevow (pre-move to the zope interfaces) and it sure didn't hurt. Alex
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