[C++-SIG] setattr and CXX-4.2
barry at scottb.demon.co.uk
Wed May 17 00:20:09 CEST 2000
getattr_methods is a helper function. Its job is to return a function object
for any of the objects C++ methods that are referenced and to deal with
references to __methods__.
For objects with functions you must call getattr_methods() from your getattr()
after dealing with all the non-function attributes your object has.
Here is an example taken from CXX\Demo\r.cxx
Py::Object r::getattr( const char *name )
if(std::string(name) == "c")
if(std::string(name) == "start")
return getattr_methods( name );
setattr is not allowed to create functions or mess up __methods__ so you simply
handle your non-function attributes and throw Py::NameError for all you know
More information about the Cplusplus-sig