Larry Hastings <[EMAIL PROTECTED]> wrote:
> I just ran a quickie experiment and determined: when leaving a scope, 
> variables are deleted FIFO, aka in the same order they were created.  
> This surprised me; I'd expected them to be deleted LIFO, aka last 
> first.  Why is it thus?  Is this behavior an important feature or an 
> irrelevant side-effect?

If you are talking about the locals in the scope of a function, it is an
artifact of how the locals array is created.  That is to say, the locals
of a function are a flat array, and are decref'd in-order.  That
ordering is the original assignment ordering in the function, which is
an artifact of how the compiler goes from local name -> FAST_LOCALS
index.  I don't believe it is an "important feature", but to decref in
any other order would be silly and/or unintuitive.


 - Josiah

_______________________________________________
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