diff --git a/doc/v2/object.html b/doc/v2/object.html index 40798e8e..ed4538af 100644 --- a/doc/v2/object.html +++ b/doc/v2/object.html @@ -905,7 +905,16 @@ template<class R> object& operator|=(object&l,R const&r);
Returns: l.
-

Example

+
+inline long len(object const& obj);
+
+ +
+
Effects: PyObject_Length(obj.ptr())
+
Returns: len() of object.
+
+ +

Example

Python code:
 def sum_items(seq):
@@ -919,35 +928,14 @@ def sum_items(seq):
 object sum_items(object seq)
 {
    object result = object(0);
-   for (int i = 0; i < seq.attr("__len__")(); ++i)
+   for (int i = 0; i < len(seq); ++i)
       result += seq[i];
    return result;
 }
 
- -

len()

-
-inline long len(object const& obj);
-
- -
-
Effects: PyObject_Length(obj.ptr())
-
Returns: len() of object.
-
- -

Example

- Python code: -
-len(obj)
-
- C++ version: -
-len(obj);
-
-

Revised - 12 January, 2006 + 13 January, 2006

@@ -955,4 +943,3 @@ len(obj); "../../../../people/dave_abrahams.htm">Dave Abrahams 2006.

-