extending python: which python code calls the c iterator methods?

2006-01-18 Thread Johannes Zellner
Hello, when extending python there are type methods tp_iter and tp_iternext. Which python code calls the c iterator methods? -- Johannes -- http://mail.python.org/mailman/listinfo/python-list

making objects unassignable "read-only" (especially when extending)

2006-01-18 Thread Johannes Zellner
Hi, can I make an object read-only, so that x = new_value fails (and x keeps it's orginal value)? This would be especially of interest for me for an object created by a c extension. -- Johannes -- http://mail.python.org/mailman/listinfo/python-list

embedding python: simulating sequence get item / set item methods

2006-01-16 Thread Johannes Zellner
Hello, when embedding python: how can I create a type which simulates item getters and setters? Something like this: void setter(PyObject* self, int i, PyObject new_value) { // do something } PyObject* getter(PyObject* self, int i) { // do something return something; } and I'd like