On Thursday 24 August 2006 02:29, Philipp von Weitershausen wrote:
> It's obviously IFoo, because:
>
>   >>> IBar['title'] is IFoo['title']
>   True
>
> I sort of expect this. Why? Because it also happens with classes:
>
>   >>> class Foo(object):
>   ...   x = object()
>   ...
>   >>> class Bar(Foo):
>   ...   pass
>   ...
>   >>> Bar.x is Foo.x
>   True

This reasoning is incorrect. You cannot ask x for the class it came from, but 
that does not mean you can invert the relationship and make the same 
argument. The better equivalent is actually the method, since it stores its 
im_class:

>>> class Foo(object):
...   def foo(self):
...     pass
...
>>> class Bar(Foo):
...   pass
...
>>> Bar.foo.im_class
<class '__main__.Bar'>
>>> Bar.foo is Foo.foo
False

> Now, you could say that interfaces don't necessarily have follow class
> semantics just because they're defined via the class statement....

I never said it has to follow those semantics. I merely noted that several 
very experienced developers gave the opposite answer (myself included) and 
the incorrect behavior in formlib is another proof of that. Thus I am 
questioning the current behavior and think that we should change it.

I do think that not being able to deduce the interface of a field correctly is 
a serious drawback.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to