== 2:
lst.remove(i)
the result is:
1
2
>>>
as you would see, '3' is missing. this problem is caused by 'lst.remove(i)'.
apparently, 'marked-and-sweep' is a solution to deal with this issue.
but I think there SHOULD BE more 'wise' trick. I wa
skull <[EMAIL PROTECTED]> writes:
Thank you for your replys.
lst[:] is did a solution, it makes a copy of list specially for iteration and
removes items from the original one.
but I still have an other thing to worry about coming with this way: does
performance sucks when the list
n lst[:]:
E2: for i in reversed(lst):
print sys.getrefcount(i)
###
E1 outputs:
4
4
4
E2 outputs:
3
3
3
It looks that the reversed does not make a copy of list in contrast with lst[:].
so should we regard: reversed is faster than lst[:]?
I do not have any idea about why it is.
- skull
--
http://mail.python.org/mailman/listinfo/python-list
Fernando RodrÃguez <[EMAIL PROTECTED]> writes:
> Hi,
>
> Is the standard output thread-safe? Can I use print from several
> threads without having to use a mutex?
>
> Thanks
>
>
Check this:
http://me.in-berlin.de/doc/python/faq/library.html#what-kinds-of-global-value-mutation-are-thread-safe
fr