Opened 9 years ago
#9687 new Patches
introduce boost::python::raw_method
Reported by: | Owned by: | Ralf W. Grosse-Kunstleve | |
---|---|---|---|
Milestone: | To Be Determined | Component: | python USE GITHUB |
Version: | Boost 1.54.0 | Severity: | Not Applicable |
Keywords: | Cc: |
Description
Hi,
I am developing a Python's module using boost::python. I need to create a method for certain class, which takes *args
and **kwargs
.
Boost::python is capable of creating a raw function/constructor, but lacks an API for creating a raw method. I attach a header, which introduces this option.
Thank you for a feedback.
Regards
Example:
namespace bp = boost::python; class ClassName { public: // ... static void init() { s_class = bp::class_<ClassName>("ClassName", /* ... */) .def("RawMethodName", bp::raw_method<ClassName>( &ClassName::MethodName, 2)); } bp::object RawMethodName( const bp::tuple &args, const bp::dict &kwargs) { // Do something with args, kwargs return bp::object(); } // ... private: static bp::object s_class; }; bp::object ClassName::s_class;
Attachments (1)
Note:
See TracTickets
for help on using tickets.
Raw method API