comparison PyFeatureSet.cpp @ 32:a8231788216c vampy2

Vampy2: accept numpy array return types.
author fazekasgy
date Mon, 21 Sep 2009 13:56:28 +0000
parents 4f1894c7591b
children
comparison
equal deleted inserted replaced
31:4f1894c7591b 32:a8231788216c
7 static int 7 static int
8 FeatureSet_init(FeatureSetObject *self, PyObject *args, PyObject *kwds) 8 FeatureSet_init(FeatureSetObject *self, PyObject *args, PyObject *kwds)
9 { 9 {
10 if (PyDict_Type.tp_init((PyObject *)self, args, kwds) < 0) 10 if (PyDict_Type.tp_init((PyObject *)self, args, kwds) < 0)
11 return -1; 11 return -1;
12 self->state = 0;
13 cerr << "FeatureSet initialised" << endl;
14 return 0; 12 return 0;
15 } 13 }
16 14
17 static int 15 static int
18 FeatureSetObject_ass_sub(FeatureSetObject *mp, PyObject *v, PyObject *w) 16 FeatureSetObject_ass_sub(FeatureSetObject *mp, PyObject *v, PyObject *w)
19 { 17 {
20 // cerr << "called FeatureSetObject_ass_sub" << endl; 18 // cerr << "called FeatureSetObject_ass_sub" << endl;
21 if (!PyInt_CheckExact(v)) { 19 if (!PyInt_CheckExact(v)) {
22 /// TODO: Set ValueError here. 20 /// TODO: Set ValueError here.
23 cerr << "Output index must be positive integer" << endl; 21 cerr << "ValueError: Output index must be positive integer" << endl;
24 return 0; 22 return 0;
25 } 23 }
26 if (w == NULL) 24 if (w == NULL)
27 return PyDict_DelItem((PyObject *)mp, v); 25 return PyDict_DelItem((PyObject *)mp, v);
28 else 26 else