len() on mutables vs. immutables

Demian Brecht demianbrecht at gmail.com
Thu Oct 18 14:38:20 EDT 2012


On 10/18/2012 11:28 AM, Nick Cash wrote:
> It appears that list has len() complexity of O(1)
> source: http://wiki.python.org/moin/TimeComplexity
> It may be worth mentioning that lists in Python are implemented using arrays instead of linked lists.
>
> It's reasonable to assume that other built-in collection types would be similar, though I don't see anything explicitly saying so for bytearray.
>
> -Nick Cash

Thanks for the link, I don't believe I had seen that one before.





More information about the Python-list mailing list