How do Java interfaces translate to Python?
gordon at doxxx.net
Mon Oct 1 00:50:15 CEST 2001
In article <j44rpk2unm.fsf at informatik.hu-berlin.de>, Martin von Loewis <loewis at informatik.hu-berlin.de> wrote:
> What exactly is it that you do with interfaces in Java?
Enforcing a contract between objects, i.e. if you want to work with this
object, your object must implement this interface.
I find myself unable to think of anything other than that. Which suggests
to me that perhaps interfaces aren't such a useful construct after all. ;)
I suppose the thing I'm really missing is compile-time type safety. Yes I
know that Python is a dynamically typed language and as such compile-time
type safety, compiling even, make no sense. But do you have any
suggestions for somebody used to compiled languages on how to deal with a
dynamically typed language like Python? I find myself making silly
syntactical mistakes which I just don't see when I visually scan the code,
and when I run the program it suddenly barfs in the middle of nowhere with
a syntax error. Very frustrating. Especially, if it takes a few minutes
and interaction from me to get to that point.
More information about the Python-list