Re: [Zope-dev] Pointer or reference object
Itamar Shtull-Trauring writes:
Jason Spisak wrote:
I had thought that Itamar's code below created an object that was exactly like the object at the URL. More like a copy. A duplicate. It that right?
No, it doesn't create a duplicate - it actually links twice to the same object.
what do you mean by reference count? Something that keeps track of all the references in the ZODB in one place. An authority?
Python has a reference count for each object. When it reached 0 the object is deleted. Consider the following example:
x = [] a = x # a and x both point at the same object a.append(3) # so if we change a... a [3] x # ...x is also changed [3] del x # this does not free any memory since a still points at this object x Traceback (innermost last): File "<stdin>", line 1, in ? NameError: x a # a still points at the data [3]
-- Itamar S.T. itamars@ibm.net
Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
participants (1)
-
Jason Spisak