Am I missing something with Python not having interfaces?

Daniel Marcel Eichler onsen-neko at gmx.net
Thu May 8 03:22:57 EDT 2008


Am Donnerstag 08 Mai 2008 00:12:26 schrieb 
bruno.desthuilliers at gmail.com:

> very often sees do-nothing catch-all try/catch blocks in Java - which
> is way worse than just letting the exception propagate. I find all
> this totally pointless, because there's just no way for a compiler to
> check if your code is logically correct.

But it's enough if the called method exists and returns the correct 
type. At least it prevents a crash.

> > Interfaces work at
> > compile-time, while method-stubs raise at their first call, so in
> > worst case, never.
> And then ? If it's never called, why bother implementing it ?

You never can't say when it's called at least, that's the point. 

> > That's the point. Interfaces garantee that a duck is a duck, an not
> > only a chicken that quack.
> Who cares if it's a chicken as long as it quacks when you ask her to
> ? Now *This* is the whole point of chicken^Mduck typing, isn't it ?-)

Ducks can also swim and fly. And if you need a really duck, but have 
onyl a chicken while the coder was to bored to make one...

Of course, in the practical world that all doesn't  matter. But in the 
theoretical world of the big coding farms, called business, that's one 
cornerstone of success, in the tinking of managers and so.



More information about the Python-list mailing list