[Python-Dev] PEP 246, redux

Phillip J. Eby pje at telecommunity.com
Mon Jan 10 23:12:40 CET 2005


At 04:16 PM 1/10/05 -0800, Michel Pelletier wrote:
> > From: Guido van Rossum <gvanrossum at gmail.com>
> > Subject: Re: [Python-Dev] PEP 246, redux
> >
> > I'm wondering if someone could do a similar thing for PEP 245,
> > interfaces syntax? Alex hinted that it's a couple of rounds behind the
> > developments in Zope and Twisted.
>
>Nothing implements 245, which is just about the syntax,

The comment Guido's alluding to was mine; I was referring to PEP 245's use 
of '__implements__', and the difference between what a "class implements" 
and an "instance provides".  Twisted and Zope's early implementations just 
looked for ob.__implements__, which leads to issues with distinguishing 
between what a "class provides" from what its "instances provide".

So, I was specifically saying that this aspect of PEP 245 (and Guido's 
basing a Python interface implementation thereon) should be re-examined in 
the light of current practices that avoid this issue.  (I don't actually 
know what Zope currently does; it was changed after I had moved to using 
PyProtocols.  But the PyProtocols test suite tests that Zope does in fact 
have correct behavior for instances versus classes, because it's needed to 
exercise the PyProtocols-Zope interop tests.)


>I like implements, but any spelling works for me.  "implements" strikes me as
>an elegant counterpart to "interface" and risks minimal breakage.  Can we
>still import and say "implements()" for b/w compatibility and for those of us
>who do want an explicit statement like that?

If I understand Guido's proposal correctly, it should be possible to make a 
backward-compatible 'implements()' declaration function.  Maybe not *easy*, 
but certainly possible.



More information about the Python-Dev mailing list