File: object_tp_as_mapping

package info (click to toggle)
python2.1 2.1.3dfsg-1sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 38,028 kB
  • ctags: 64,228
  • sloc: python: 186,023; ansic: 184,754; xml: 43,435; sh: 12,381; makefile: 3,523; perl: 3,108; lisp: 2,460; cpp: 106; sed: 2
file content (34 lines) | stat: -rw-r--r-- 695 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

/* Code to access $name$ objects as mappings */

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

static PyObject *
$abbrev$_subscript(self, key)
	$abbrev$object *self;
	PyObject *key;
{
	/* XXXX Return the item of self indexed by key */
}

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

static PyMappingMethods $abbrev$_as_mapping = {
	(inquiry)$abbrev$_length,		/*mp_length*/
	(binaryfunc)$abbrev$_subscript,		/*mp_subscript*/
	(objobjargproc)$abbrev$_ass_sub,	/*mp_ass_subscript*/
};

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