How is the execution order of 'x = z'? (also: Python FAQ 4.88)
Ames Andreas (MPA/DF)
Andreas.Ames at tenovis.com
Tue Jul 22 13:16:37 EDT 2003
Hello,
during execution of an assignment statement like
x = y
.
.
.
x = z # <--
is y's reference count decremented (and therefore its __del__ possibly
called) *before* x is bound to z (or is z bound to x, I don't know the
correct wording) or *afterwards*?
I'm asking because I want to use threading.RLock but I'm a little
scared about the use of the '__owner' instance variable without
locking throughout the whole implementation. Python FAQ 4.88 seems to
suggest y is deleted before x is rebound, in which case I'd rather not
use RLock (because several of Thread's ctor arguments can very well be
objects with explicit __del__ methods and the Threads which should use
my RLock are definitely not under my control).
Please note that I'm using Python 2.1; I haven't looked at the
implementation in more recent versions.
Just curious, TIA
andreas
More information about the Python-list
mailing list