object_tp_as_mapping 695 Bytes
Newer Older
1

2 3 4 5 6 7 8 9 10
/* Code to access $name$ objects as mappings */

static int
$abbrev$_length(self)
	$abbrev$object *self;
{
	/* XXXX Return the size of the mapping */
}

11
static PyObject *
12 13
$abbrev$_subscript(self, key)
	$abbrev$object *self;
14
	PyObject *key;
15 16 17 18 19 20 21
{
	/* XXXX Return the item of self indexed by key */
}

static int
$abbrev$_ass_sub(self, v, w)
	$abbrev$object *self;
22
	PyObject *v, *w;
23 24 25 26 27
{
	/* XXXX Put w in self under key v */
	return 0;
}

28
static PyMappingMethods $abbrev$_as_mapping = {
29 30 31 32 33 34
	(inquiry)$abbrev$_length,		/*mp_length*/
	(binaryfunc)$abbrev$_subscript,		/*mp_subscript*/
	(objobjargproc)$abbrev$_ass_sub,	/*mp_ass_subscript*/
};

/* -------------------------------------------------------- */