|
Re: list.len(): msg#00270python.c++
Philippe Fremy <phil@xxxxxxxxxxxxxxx> writes: > Hi, > > I am using boost 1.30 and I was surprised to discover that in > boost::python::list, there is no len() method. Am I mistaken or is > PyList_Size( my_list.ptr() ) the only way to get the length ? > > If so, I suggest to add it in the future. It is very common to use the size > of a list when operating upon it. We should have it, but it should be a namespace-scope function, not a method. len(some_list) and len(some_tuple) should work equally well. There are actually a whole suite of these functions which ought to be in the library, added to namespace boost::python::api (see boost/python/object_protocol.hpp for some examples). Patches are welcome, if they include user documentation and tests! -- Dave Abrahams Boost Consulting www.boost-consulting.com |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: using BOOST_PYTHON_STATIC_LIB: 00270, David Abrahams |
|---|---|
| Next by Date: | Re: Re: using BOOST_PYTHON_STATIC_LIB: 00270, Rene Rivera |
| Previous by Thread: | list.len()i: 00270, Philippe Fremy |
| Next by Thread: | Re: Re: list.len(): 00270, Ralf W. Grosse-Kunstleve |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |