MORE ON REFCOUNTING
Courageous
jkraska1 at san.rr.com
Thu May 25 03:13:09 EDT 2000
Okay. I'm working on a deque implementation for python, and I believe
I may be getting this whole reference count thing down pat. I'll comment
on it:
o=Class() // creates an instance object, refcount == 1
d=deque.Create()
d.PushHead(o) // creates an intermediate tuple to pass to the
// external function, raising reference count to 2.
// C function stores 'o', raising refcount to 3.
// intermediate tuple object is gone, refcount back down to 2.
d.PopHead()
// pophead decrefs refcount, refcount back down to 1, right where it should be
???
More information about the Python-list
mailing list