[Python-3000] Discussions with no PEPs

Jan Grant jan.grant at bristol.ac.uk
Wed Mar 14 10:25:39 CET 2007


On Tue, 13 Mar 2007, Phillip J. Eby wrote:

> Java, ironically, avoids this problem by forcing you to have new types for 
> every single damn thing.  The idiomatic way to have a priority-ordered 
> sequence of socket event listeners is to make a new base class or interface 
> just for that purpose -- so you end up with receiver-oriented interfaces as 
> a side effect!  (In addition, Java has just enough overloading support that 
> a lot of the common cases for what would be type tests in Python, are done 
> using overloads in Java.)

I believe this parenthetical statement is the most important one*. I've 
done a lot of recent work in Java, and my liking of interfaces is that 
they encourage developers to think in terms of contracts (for some 
arguably weak value thereof). A set of interfaces offer a nice way 
to document the APIs of coarse-grained components.

Java has, as Phillip puts it, "receiver-oriented interfaces"; adapter 
classes are a fairly trivial thing to generate (my IDE does it for me) 
and crop up somewhat often as different large-scale components are 
plumbed together. So they do require some machinery, and java has no 
magical adaption (which I must confess, I like). But then Java is by 
design a language lacking many kinds of magic.

The key point is that java methods are overloaded. That makes the 
interface notion as expressed in Java useful. Python methods are not 
overloaded. So interfaces (ABCs) as the sole feature of Python would 
perhaps retain the documentation features that I find compelling; but 
they would, alone, be much klunkier in use.

Cheers,
jan

* it convinces me anyway.

-- 
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661   http://ioctl.org/jan/
"My army boots contain everything not in them." - Russell's pair o' Docs.


More information about the Python-3000 mailing list