What is the class of myobj?

JXStern JXSternChangeX2R at gte.net
Wed Oct 16 00:44:43 EDT 2002


On Tue, 15 Oct 2002 18:46:16 -0700, Erik Max Francis <max at alcyone.com>
wrote:
>isinstance(myobj, MyClass)
>
>Though the Pythonic way is to just assume it's got the right interface;
>if it doesn't, an error will get raised and you can handle the problem
>at that point.

Thanks to you and Mark.

Sometimes it's too easy, I guess.  I actually looked at isinstance()
but somehow didn't note the second parameter?  Is that possible?  No,
I looked at isclass(), which only takes one!  Oy.

Now, you raise the issue whether I want to use it anyway.  Have to
think about that.  I just wanted to assert the type of an argument
being passed in, but maybe that's not Pythonic.

Joshua Stern




More information about the Python-list mailing list