You could try this instead: (untested!)
using namespace boost::python;
tuple a = make_tuple("hello", 42);
std::cout << "Length = " << boost::python::len(a) << std::endl; //
explicit namespace not needed
hth,
Brian
2010/1/4 Simon Pickles <[email protected]>
> Hello,
>
> I have a simple question. How do I find out in c++ how many elements are
> contained within a boost::python::tuple?
>
> I tried this:
>
> using namespace boost::python;
> tuple a = make_tuple("hello", 42);
> object b = a.attr("length"); // exception
> unsigned int c = extract<unsigned int>(b);
> assert( c==2 );
>
> AttributeError: 'tuple' object has no attribute 'length'
>
> Am I missing something?
>
> Thanks
>
> Si
> _______________________________________________
> 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