Pop a list from beginning ? and memory saving...
Shagshag13
shagshag13 at yahoo.fr
Sun Jun 2 05:44:32 EDT 2002
I had a huge list containing consuming data, as i only need a one pass in a
for statement,
i'm wondering if by doing this with a pop i could save memory ? (as i think
that python
free it after the pop...)
and is there a way to pop from the beginning of the list ? (i think i could
use reverse but
i don't know if this memory consuming)
>>> a = [1,2,3,4,5,6,7]
>>> while 1:
try:
f = a.pop()
except IndexError:
break
print f
thanks,
s13.
More information about the Python-list
mailing list