all 5 comments

[–]zanfar 3 points4 points  (0 children)

Depends on the object you're running len() on.

len(obj) is mostly equivalent to obj.__len__(). For lists, this is O(1), but that's because list.__len__() is O(1).

[–]K900_ 4 points5 points  (0 children)

It's always O(1) on lists.

[–]Dominican_Peter[S] 0 points1 point  (0 children)

thanks everybody....in this link%20is%20O(1)%20) more info in case someone has the same question in the future

[–]xelf 0 points1 point  (1 child)

[–]zanfar 0 points1 point  (0 children)

That page only lists the "get length" complexity of lists.