Am 30.11.2009, 19:51 Uhr, schrieb Chris McDonough <chr...@plope.com>:
> + 1 with the following caveat: > I think that method name should probably be "adapt"; "lookup" should > maybe be > a separate method reserved for passing bare interfaces rather than > objects > which implement interfaces, e.g: > >>> IFoo.lookup(IBar) > <class FooBarAdapter> I think that lookup is a registry function. Not sure if there is anything to be gained by making it available on the interface. But +1 on explicit methods over collapsing it into the language. I can see advantages of having a Pythonic idiom for this in the future as with set, dictionaries, etc. but at the moment I think the risk of confusion is greater than the shorthand advantage. However, I think this is going to turn out to be a matter of personal preference. > This would be consistent with the nomenclature in the current > zope.interface > AdapterRegistry API. > If it would help to change the resulting error message to "adaptation > error" > when ".adapt" is called, e.g.: > >>> IFoo.adapt(c, default='missing') > Traceback... > AdaptationError(...) Having struggled to work out why I get the errors I do anything that provides more information as to why I can't adapt, ie. which interfaces are required I'd love something more than the current TypeError Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )