C API: Change immutable objects? :-o

Greg Ewing see_reply_address at something.invalid
Mon Aug 5 07:31:40 CEST 2002

Frank Sonnenburg wrote:

> Hi there
> I'm trying to speed up updating my PyObjects, e.g. PyFloat.
> So instead of deleting the old object and creating a new one with my new 
> double value, i over-write the old value in the PyFloatObject-struct:

You *might* get away with it if you make sure the
object has a reference count of 1 before doing it.

If not, you risk odd and unpredictable things
happening resembling the old Fortran changing-
a-constant trick!

Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand

More information about the Python-list mailing list