properly delete item during "for item in..."
rjagodic at gmail.com
Thu Jul 17 18:27:27 CEST 2008
Say you have something like this:
for item in myList:
Would this actually delete the item from the list or just decrement
the reference counter because the item in myList is not associated
with name "item" anymore (but still is with myList[itemIndex])? In
other words, is "item" a temporary reference to myList[itemIndex] or
is it actually that reference that myList has stored?
I am not sure if this question even makes any sense anymore. I've been
using python for years and never had any problems (and I don't now
either) but now that I had to revisit c++/STL, I had to deal about
these issues and was wondering how python does it.
More information about the Python-list