Python C extension: Value different if passed as list than if passed as number

Anand anand_soliton at yahoo.com
Wed Sep 10 21:02:39 EDT 2003


My bad. I wanted to do a inplace memory write for an int. so 

i = 0;
func(i);
print i;

======
output = 1.

The funny thing is python doesnt use 0 as 0. instead it points to a
memory location whose value = 0.

Since in my inplace replace, i changed that value from 0 to 1, 
test[0] actually became test[1] :))

so i had tons of strange behavior happening. I shouldnt have made an
immutable object as mutable.




More information about the Python-list mailing list