How to del item of a list in loop?
Nick Coghlan
ncoghlan at iinet.net.au
Sun Jan 16 06:05:59 EST 2005
John Machin wrote:
> Nick Coghlan wrote:
>>The effbot's version is still going to be faster though:
>> lst = [x for x in lst if x != 2]
>
>
> Have you measured this?
Nope. I'm going purely on the fact that it is O(n), and the in-place
modification will always be worse than that.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at email.com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
More information about the Python-list
mailing list