[Boost-bugs] [Boost C++ Libraries] #9687: introduce boost::python::raw_method

Subject: [Boost-bugs] [Boost C++ Libraries] #9687: introduce boost::python::raw_method
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-20 10:00:40


#9687: introduce boost::python::raw_method
------------------------------+----------------------------
 Reporter: phatina@… | Owner: rwgk
     Type: Patches | Status: new
Milestone: To Be Determined | Component: Python
  Version: Boost 1.54.0 | Severity: Not Applicable
 Keywords: |
------------------------------+----------------------------
 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:
 {{{
 #!cpp

 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;

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9687>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC