On 5/10/06, Bill Birch <[EMAIL PROTECTED]> wrote:
> A simple test to see where your thinking is at. Consider:
[...]
> The manual for isinstance() says: "return true if classinfo is a type object
> and object is an object of that type". So consider this:
>
>          isinstance( D(), I1 )
>
> Is this True or False?

(Making obvious assumptions about the syntax that isn't "real" Python...)

Clearly False - D() is not an object of type I1.

Of course, whether isinstance() is actually a useful way of checking
depends on what you're trying to discover. It's very rare that I'd
care about the actual class inheritance structure of an object. What I
care about is whether I can *use* it like an I1. And that's not
decidable (it includes semantic considerations), so no builtin can
answer that question for me.

Hence, I document my expectations, and trust my caller to follow the
documentation. We're all consenting adults, and all that... (Note:
This is ideal documentation, not real-life, you understand :-))

So where does that put my thinking?

Paul.
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to