Could Python supplant Java?

Steve Austin joeking at merseymail.com
Wed Aug 21 12:40:15 EDT 2002


[snipped...]
> 'filelike' might be a file handle.  It might be a urllib object.  It
> might be a gzip object.  It might be a string buffer.  Or it might be
> some custom object with a .read() method that I had not even thought of
> when I wrote the code.

Surely that's just polymorphism?  Not exactly the same 
as dynamic or static data typing - which was the subject 
at hand.  For example, Java is statically typed, but 
can still do the above.

> In some OOP languages you might handle this by requiring that 'filelike'
> inherit from File, or whatever.  But that is far too rigid a class
> hierarchy requirement, IMO.

Isn't that what interfaces were invented for?  :-)




--
-FISH-   ><>

<joeking at merseymail.com>

--------------------------------------------------------------------
Get your own FREE local e-mail address at http://www.merseymail.com/




More information about the Python-list mailing list