return a->ob_size;
}
+
+
+static int
+list_contains(a, el)
+ PyListObject *a;
+ PyObject *el;
+{
+ int i, cmp;
+
+ for (i = 0; i < a->ob_size; ++i) {
+ cmp = PyObject_Compare(el, PyList_GET_ITEM(a, i));
+ if (cmp == 0)
+ return 1;
+ if (PyErr_Occurred())
+ return -1;
+ }
+ return 0;
+}
+
+
static PyObject *
list_item(a, i)
PyListObject *a;
(intintargfunc)list_slice, /*sq_slice*/
(intobjargproc)list_ass_item, /*sq_ass_item*/
(intintobjargproc)list_ass_slice, /*sq_ass_slice*/
+ (objobjproc)list_contains, /*sq_contains*/
};
PyTypeObject PyList_Type = {
return a->ob_size;
}
+static int
+tuplecontains(a, el)
+ PyTupleObject *a;
+ PyObject *el;
+{
+ int i, cmp;
+
+ for (i = 0; i < a->ob_size; ++i) {
+ cmp = PyObject_Compare(el, PyTuple_GET_ITEM(a, i));
+ if (cmp == 0)
+ return 1;
+ if (PyErr_Occurred())
+ return -1;
+ }
+ return 0;
+}
+
static PyObject *
tupleitem(a, i)
register PyTupleObject *a;
(intintargfunc)tupleslice, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
+ (objobjproc)tuplecontains, /*sq_contains*/
};
PyTypeObject PyTuple_Type = {