Are there 'Interfaces' in Python??

Carl Banks idot at vt.edu
Sat Sep 29 11:27:16 EDT 2001


Titus Brown <t at chabry.caltech.edu> wrote:
>  
> Interfaces (or better, signatures, as you describe below) seem to
> have the advantage of being up-front about checking requirements,
> rather than being a bit lacksadaisical about when requirements are
> checked.

Well, I do agree that is the downside to not having interfaces.


>>And I do agree that there should be some reference for what that
>>convention is.  (For file-like object, I'd say use the )
> 
> ...Python library documentation?

Heavens, no.  Use the built-in file type as a reference.  And have
Guido decree that it is so.


> I like the idea -- and at least now I have something to call the constructs
> in my own code!  Can you give me an example of a language that uses them?
> 
> Learn something every day... ;)

Well, the C++ compiler in gcc adds signatures as an extension; I
originally learned about them from gcc's info documentation.
According to that source, other languages that have them are ML
(evidently where they originated), Haskell (called type classes
there), Modula-2 and Modula-3, and some other languages I've never
heard of.

The info node is interesting and explains signatures pretty well.  If
you don't have access to gcc's info documentation, you can probably
find a copy online with a Google search on these words (not quoted):

gnu signature polymorphism purdue haskell


-- 
CARL BANKS



More information about the Python-list mailing list