Is there a consensus on how to check a polymorphic instance?

Mike Meng meng.yan at gmail.com
Wed Nov 24 04:58:31 CET 2004


> I come from a very conservative background in software development
> and strong checks are deeply rooted in my mind.

So do I, Dan.

I just can't imagine a `wild'  object whose interface is valid can
truely do the right things. While in fact, when I typing this word, I
realize we can't ensure the internal protocol will be obeyed even when
the object IS-A base class instance.

Maybe it's time to rethink.

It seems to me the virtue of dynamic langauge is, if it looks like a
cat, it's a cat.  But the problem is still there: how do you know what
it looks like before you treat it as a cat? isinstance(), , as Steve
state, is too rigid.




More information about the Python-list mailing list