Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > But less exotically, Frank isn't entirely wrong. With current day > computers, it is reasonable to say that any object has exactly one > physical location at any time. In Jython, objects can move around; in > CPython, they can't. But at any moment, any object has a specific > location, and no other object can have that same location. Two objects > cannot both be at the same memory address at the same time. >
It is however perfectly possible for one object to be at two or more memory addresses at the same time. In fact some work being done in PyPy right now is doing exactly that as part of Armin Rigo's software transactional memory implementation: when a global object is mutated a new copy is made and some threads may see the new version while other threads continue to see the old version until their transactions are comitted (or aborted). This means that global objects can be safely read from multiple threads without any semaphore locking. See http://mail.python.org/pipermail/pypy-dev/2012-September/010513.html -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list