PEP 245: Python interfaces
Martin von Loewis
loewis at informatik.hu-berlin.de
Mon Mar 26 03:41:28 EST 2001
Michel Pelletier <michel at digicool.com> writes:
> > Even though this is quite a long document, it is incomplete.
>
> Yes, *sigh*. I know I need more formalism, but should this be at the
> expense of the section on goals? I'm not sure. I was raised in an XP
> environment, the goals are the most important part to me. This is
> something I've been debating myself over. I obviously want the PEP to be
> accessable and not boring, but I also want it to be comprehensive.
I agree with Tim's comments on this issue. I personally would prefer
it to be complete but boring. There should be a clear rationale of
what this wants to achieve, and a specification of how it achieves
that. Examples why it is useful to have that feature, and a tutorial
on using it are both optional. Readers are then expected to evaluate
whether they like the rationale, and whether they think the
specification fulfills the goals in the best possible way.
> > - packaging. I think the hierarchy is too deep, everything should be
> > contained in the interfaces module (there is not an awful lot of
> > stuff in it, is there?).
>
> How do you mean? I don't think the PEP proposes any depth beyond the
> Interface module.
It mentions an Interface.Exceptions module. The reference
implementation also has Interface.InterfaceBase, Interface.Method,
Interface.Standard and other modules.
> Ah yes, this is an interesting point of debate. The idea here is
> that the interface of an interface is *not* the interface that it
> describes. I was not around when the types-sig (and Jim) came up
> with this; I cannot give you the exact motivation, but it feels
> right to me. If you'd like, I can add a section to 'Dissenting
> Opinions' section on this point.
I agree that an interface of an interface is not the interface that it
describes. That does not rule out using attribute access syntax to
navigate through the interface description. Suppose you have
interface Foo:
def bar(self):
"Hello"
class Foo_impl implements Foo:
def bar(self):
return "Hello"
foo = Foo_impl()
then foo.bar() is usage of the interface being described; foo.bar is a
bound method. I'm not requesting that Foo.bar is a method (bound or
unbound); I'm requesting that it returns a method description.
Regards,
Martin
More information about the Python-list
mailing list