> > Consider 'iter()', for example, which can be viewed as adapting an > > object to the "iteration interface" and returning an object > > supporting iteration. > > An architecture astronaut might view it that way, but > I don't. To my way of thinking, iter(x) creates a new > object that iterates over x. Calling it a form of > adaptation just muddies things with uneccessary words.
FWIW, Phillip was pointing out the following similarity: >>> class IIterable(Interface): pass ... >>> class IIter(Interface): pass ... >>> class C(object): ... interface.implements(IIterable) ... def __iter__(self): return iter("foo") ... >>> def adapt_to_iter(obj): ... return obj.__iter__() ... >>> component.provideAdapter(adapt_to_iter, (IIterable,), IIter) >>> >>> iter(C()).next() 'f' >>> IIter(C()).next() 'f' As mentioned before, the similarity doesn't hold for more complex interface hierarchies. -- Gustavo Niemeyer http://niemeyer.net _______________________________________________ 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