Glenn Linderman, 27.01.2010 10:13: > As a newcomer to python, I must say that I wouldn't expect a list to be > like an array. I'd expect it more to be like a list... many > implementations of lists (linked lists, in particular) make it O(1) to > add to the front or back. An array can be used to represent a list, but > there are known inefficiencies that result when doing so
Performance-wise, there are a lot more "inefficiencies" in linked lists for the most common use cases than in arrays. It's hinting to see how common the List l = new ArrayList() idiom is in Java (plus generics, obviously). I can't remember seeing any other kind of initialisation in ages. That's a huge difference between Java and Python, BTW. Python optimises for common use cases to keep you from thinking too much about implementation details, whereas Java just leaves you alone with all possible solutions for all possible use cases and forces you to choose the right one at each single code line you write. Stefan _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com