On 12/3/2010 11:06 PM, Cameron Simpson wrote:
On 03Dec2010 18:15, James Y Knight<f...@fuhm.net>  wrote:
| On Dec 3, 2010, at 6:04 PM, Terry Reedy wrote:
|>  gc is implementation specific. CPython uses ref counting + cycle
|>  gc. A constraint on all implementations is that objects have a fixed,
|>  unique id during their lifetime. CPython uses the address as the id, so
|>  it cannot move objects. Other implementations do differently. Compacting
|>  gc requires an id to current address table or something.
|
| It's somewhat unfortuante that python has this constraint, instead of
| the looser: "objects have a fixed id during their lifetime", which is
| much easier to implement, and practically as useful.

Python doesn't have the constraint you imagine; it _does_ have "objects
have a fixed id during their lifetime".

"id(object)
Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime."

Of course, other implementations are free to change builtins, but code that depends on CPython's definitions will not run.

--
Terry Jan Reedy


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to