On 1/30/02 4:08 AM, "Toby Dickenson"
<[EMAIL PROTECTED]> wrote:

> On Mon, 28 Jan 2002 16:37:16 -0700, Jeffrey P Shell
> <[EMAIL PROTECTED]> wrote:
> 
> Many convincing arguments, but somehow I am not persuaded.
> 
>> Or, if you were defining the interface in IDL (mmm,
>> almost-avoiding-redundancy through acronyms!) with the target language being
>> Python, would you include self?
> 
> But what if you were defining an interface as a Python class, with the
> target language being <anything except python>. Would you include
> self?

I'm saying that you wouldn't.  The point of IDL/ISL is that you wouldn't,
because the interface that you're specifying is independent of the target
language.

> I think my conclusion here is that using python classes to define
> interfaces may be counterproductive.

It may be the best we have (it's best understood by the target development
audience), unless PEP 245 [1] gets accepted into Python.  You can also
declare interfaces in a more declarative fashion, but I do have to say that
the class way is preferable.  Contrast::

>>> meths = {'sayHello': Interface.Method("Says hello to the user"),}
>>> IHello = Interface.new('IHello', [], meths)
>>> IHello.names()
['sayHello']

Is basically the same as:
>>> class IHello2(Interface.Base):
...   def sayHello():
...     "Says hello to the user"
... 
>>> IHello2.names()
['sayHello']

..[1] http://python.sourceforge.net/peps/pep-0245.html

-- 
Jeffrey P Shell 
www.cuemedia.com



_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to