Hi, I tried to understand the docs of Peak's PyProtocols, and failed. I use PyProtocols v0.93 final. I fetched the ...tar.gz file for Linux and installed it using the setup.py. Here's my Hello-World-like example, that defines a Duck, which "implements" the given Interface:
from protocols import Interface,adapt,advise class Quackable(Interface): def quack(loudness): """ print how loud to quack """ class Duck: advise(instancesProvide=[Quackable,]) def quack(self, loudness): print "quack! %s loud"%(loudness) if __name__ == "__main__": d = adapt(Duck, Quackable) # this line raises the failure d.quack(3) ************ But it does not work that way. It get this "AdaptionFailure" : File "...interfaces.py", line 14, in ? d = adapt(Duck, Quackable) File "C:\cygwin\home\pje\PyProtocols\src/protocols/_speedups.pyx", line 199, in _speedups.adapt File "C:\cygwin\home\pje\PyProtocols\src/protocols/_speedups.pyx", line 188, in _speedups._adapt protocols.adapters.AdaptationFailure: ("Can't adapt", <class __main__.Duck at 0xb7bcc47c>, <class '__main__.Quackable'>) *************** Or is my Duck code wrong ? Anybody knowing how to use an Interface ? Thank you very much- Nebur Remark:There seems to be some windows stuff in PyProtocols ("C:\...") - a bug ? (I re-installed PyProtocols with option --without-speedups but nothing changed.) -- http://mail.python.org/mailman/listinfo/python-list