Order of constructor/destructor invocation

Björn Lindberg d95-bli.no at spam.nada.kth.se
Fri Mar 8 05:59:57 EST 2002


Christian Tanzer wrote:

> Agreed. I relied on that.
> 
> > In this example s1 will be constructed first followed by s2.
> 
> And here I am wary. Does the standard prescribe this? For normal
> expressions at least, you can't rely on evaluation order. But then, in
> comma separated expressions you can. So maybe this is safe after all.

I believe it is, but I'm not certain. As you say, evaluation order for
comma separated expressions are defined. I'd have to ask someone with a
copy of the standard handy for this. Anyway, what I AM certain of is
that the destruction order is opposite of the construction order.


Björn



More information about the Python-list mailing list