Guido van Rossum wrote: > Fascinating ideas in this thread! > > I spent some time blogging about this on artima: > http://www.artima.com/weblogs/viewpost.jsp?thread=155123 > > I have to write my slides for a talk about Py3K later today, but I'll > be back. In the mean time I've rejected PEPs 245 and 246 in > expectation of something better that's imminent!
What's still missing IMHO is a way for an adapter to defer to the next adapter in the chain, i.e. something like: class Protocol(object): def register(self, ...): ... def __call__(self, ...): ... def default(self, *args, **kwargs): raise TypeError def candidates(self, *args, **kwargs): return type(args[0]).__mro__ def super(self, *args, **kwargs): search = iter(self.candidates(*args, **kwargs)) for key in search: if key in self.registry: break try: return search.next()(*args, **kwargs) except StopIteration: return self.default(*args, **kwargs) With this an adapter could use the super() method to call the next adapter in the chain: p = Protocol() @p.register(Foo) def p_foo(foo): p.super(foo) Servus, Walter _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com