|
Boost : |
From: Barry Scott (barry_at_[hidden])
Date: 2000-11-01 18:37:26
> > > > 3. dir(class) does not list the functions available in the class
> > > > (See the code of dir in the Python sources for the names of the
> > > > secret names it access via getattr. CXX has support for some
> > > > of them.)
> > >
> > > Isn't __dict__ support enough to accomplish that?
> >
> > No as dir looks for __methods__ as a special case.
>
> Sorry, I'm a bit confused, as it seems to work for me with only __dict__
> support, and built-in Python classes don't have a __methods__ attribute (at
> least, not in Python 1.5.2):
I think the idea in Python dir is to allow a type to have methods
and members that are not in the __dict__ and thus cannot be changed
without the type's code getting involved.
In CXX __methods__ lists the functions of the type that
are public. They are not in __dict__ and cannot be damaged
from Python code. CXX does not support __members__ by default.
I wonder if it is possible to remove a function from a py_cpp type
by assigning into the __dict__ from python.
BArry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk