PEP 245

Scott Finnie scott at projtech.com
Fri Apr 6 08:16:33 EDT 2001


Hmmm.  A question about PEP245: how do interfaces differ from types?

Both seem to have the same motivation: to declare not what something is,
but what it can do:

 . "An object's type ... determines the operations that an object 
    supports (e.g., ``does it have a length?)"
    - Python Language reference section 3.1
 . "Interfaces try to provide a way for you to ... specify a contractual 
    obligation for your object"
   (PEP245, "The Problem" section).

There are currently limitations on typing (only covers built-ins, object
can only be of a single type) but neither of these seem justifiable
reasons for introducing a new construct rather than extending the
existing one?

 - Scott.



More information about the Python-list mailing list