C API: Change immutable objects? :-o

Skip Montanaro skip at pobox.com
Fri Aug 2 13:48:06 EDT 2002


    >>> 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:

Safe as long as the reference count is 1.

    >> You are a brave, brave man.

    Frank> Ok, i understand this as "keep your hands off!"

    Frank> Anyway, i'm still experimenting. At first i will use
    Frank> "old-fashioned" style. ;-)

If you are creating lots of floats, perhaps the array module can help you
keep a lid on the actual number of PyFloatObjects that are created.

-- 
Skip Montanaro
skip at pobox.com
consulting: http://manatee.mojam.com/~skip/resume.html




More information about the Python-list mailing list