Slices time complexity

Mark Lawrence breamoreboy at yahoo.co.uk
Wed May 20 16:47:46 EDT 2015


On 20/05/2015 20:51, Mario Figueiredo wrote:
> On Wed, 20 May 2015 03:07:03 +1000, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>
>> Yes, a slice can be expensive, if you have (say) a ten billion element list,
>> and take a slice list[1:].
>
> Since nothing seems to surprise you and you seem so adamant on calling
> anyone being surprised by it, maybe I will surprise you if you
> actually run the code I posted on the OP and witness for yourself that
> even on a 50 element list will take 3 seconds to execute on an intel
> i5.
>

Please provide the figures to back up this claim.  Nothing personal but 
we've had problems with the RUE (amongst others) making nonsensical 
claims, please don't take us down that path, thank you.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list