Use the python special function __getitem__ So, something like this:
.def( "__getitem__", &Foo::operator[], boost::python::arg( "index" ), boost::python::return_internal_reference<>() ) If you want your container iteratable, see the docs for boost::python::range. Charles On Wed, Sep 8, 2010 at 2:22 PM, Junwei Zhang <[email protected]> wrote: > Hi, > > If I have a class support operator[] and operator() for indexing purpose. > How can I wrapper it in python? > > -- > Junwei Zhang > Office Phone:402-472-1968 > [email protected] > www.junweizhang.com > Department of Electrical Engineering > University of Nebraska-Lincoln > 209N Walter Scott Engineering Center > P.O. Box 880511 > Lincoln, NE 68588-0511 > _______________________________________________ > Cplusplus-sig mailing list > [email protected] > http://mail.python.org/mailman/listinfo/cplusplus-sig > _______________________________________________ Cplusplus-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/cplusplus-sig
