Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-11-26 09:13:16


Oops again. On second look it seems that Python 2.0 will in fact do
isinstance() properly on extension classes without any outside help.

-Dave

----- Original Message -----
From: "Anton Gluck" <gluc_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, November 26, 2000 1:23 AM
Subject: [boost] py_cpp: isinstance with extension classes

> Dave,
>
> Is there a difference between py_cpp extension classes and regular Python
> classes when it comes to isinstance(object, classname)? I have exposed two
> classes for variables, CatVar and ContVar, as well as their base class,
> Var. I can create CatVar and ContVar objects, and call their functions.
> But when I try to determine whether a given Var is a CatVar or a ContVar
> with isinstance(someVar, CatVar) I get a "TypeError: second argument must
> be a class". And indeed, when I do type(CatVar) it is not "type 'class'"
> but "class py::MetaClass<class py::ExtensionInstance> object at ..".
>
> I was under the impression that extension classes are like Python classes,
> with some extras. Is it possible to use isinstance or something like it?
>
> Thanks,
>
> Toni
>
>
>
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk