Showing posts with label rant. Show all posts
Showing posts with label rant. Show all posts

Saturday, 2 May 2009

Python rant: vague built-in data structures

It's surprisingly hard to find out details about built in data structures in Python. For example, the official python data structure tutorial talks about using lists as queues but doesn't mention that list.pop(0) is expensive (O(n)), and doesn't mention that the list is implemented as an array. The documentation of list is very short and omits details related to computational complexity. I like how Java in contrast makes things a lot clearer (LinkedList vs ArrayList etc).

I wonder if the decision was based on the assumption that those using Python wouldn't want to bother with computational complexity? (On the other hand they introduced array in Python 2.6.)

To quantify this rant I Google searched for "<language>" "data structure" "computational complexity". Below are the number of estimated search results.

8990 C++
8780 Java
4090 Matlab
3020 Python

Even Matlab scores higher than Python!