Replace single character at given position

2006-09-19 Thread Martin Kulas
Hello! How do I replace a single character in a string at a given position? >From programming languages like C I expect something like that: >>> idx = 1 >>> s1 = "pxthon" >>> s1[idx] = 'y' Traceback (most recent call last): File "", line 1, in ? TypeError: object does not support item assignme

Re: Py_BuildValue("I", ...) does not work

2006-08-21 Thread Martin Kulas
Nick Craig-Wood wrote: > I tried your examples under linux. > > It fails under python 2.3 in the same fashion as you noted, but works > under 2.4. > > On my system (debian/testing) I have python 2.4.4c0 installed. I was running Python 2.4.2 -- this was the problem! After Installing 2.4.3 Py_BuildV

Py_BuildValue("I", ...) does not work

2006-08-21 Thread Martin Kulas
Hallo! I have a problem with Py_BuildValue: I want to convert an unsigned int to a PyObject *. http://docs.python.org/api/arg-parsing.html says that I can use "I" as a format string. But it does not work :-\ Here is my simplified code: $ cat -n mini.c 1 #include 2 3 static