[C++-sig] Re: creating an instance of a class_<> object in c+ + and exporting it to python

Francois Ostiguy ostiguy at fnal.gov
Tue Aug 17 02:46:32 CEST 2004


> I believe that you will not see the "dummy" method by doing dir(). IIRC
> boost.python hijacks __getattr__ to delegate the lookup to the c++
> implemented code. Just try a.dummy(), does it work?
> max
>


I used boost.python in the past to wrap a fairly large API.
The exposed interface is always correctly reported by dir().
In answer to your question, here is what I get:


GCC 3.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from inject import *
>>> print a.dummy
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'A' object has no attribute 'dummy'
>>>



-Francois

----------------------------------------------------------------------------
Dr. Jean-Francois OSTIGUY                              voice: (630) 840-2231
Beam Physics Dept MS220                                  FAX: (630) 840-6039
Fermi National Accelerator Laboratory                email: ostiguy at fnal.gov
Batavia IL 60510-0500                           WWW:www-ap.fnal.gov/~ostiguy




More information about the Cplusplus-sig mailing list