[Types-sig] Interface PEP

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
19 Mar 2001 18:10:37 GMT

Mon, 19 Mar 2001 01:22:21 -0800, Paul Prescod <paulp@ActiveState.com> pis=

> Perhaps there needs to be a "strict" modifier to declarations that
> says whether merely checking for methods is sufficient or whether
> an explicit declaration is required. It should probably be up to
> a specific function whether it wants to use the first method of
> checking, or the second, or both.
> On the other hand, perhaps it is just extra complexity.

IMHO it's unnecessary complexity. A good language should not support
a wide variety of flavors of a feature, but one well defined flavor
which can cover the variety inside its framework.

In this case there should be one flavor of "checking whether the object
conforms to an interface". Interfaces themselves can be more or less
strict, and there can even be a way to transform in one direction or
another if it makes sense in general.

> Python already has types and classes. I'm adding something that
> you call protocols. Michel is adding something that he calls
> interfaces. It makes sense to have type declarations that reference
> all four. It is important to me to simplify this model...

Indeed. So instead of saying
- how to check a type
- how to check a class
- how to check a protocol
- how to check an interface
we should say
- how to check an interface (or whatever it's called)
- how to make an interface from a type
- how to make an interface from a class (should be similar to the type)
- how to make an interface from a protocol (or whatever)
(sorry, I don't remember which are protocols and which are interfaces).

In other words, the interface of an interface should be simple.
Interfaces themselves can be complex and built in sophisticated ways.

 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
  ^^                      SYGNATURA ZAST=CAPCZA