[BangPypers] Tuples vs Lists, perfromance difference
Roshan Mathews
rmathews at gmail.com
Thu Dec 24 08:32:36 CET 2009
On Thu, Dec 24, 2009 at 12:50 PM, Praveen Kumar
<praveen.python.plone at gmail.com> wrote:
> O(n) is O(n) is O(n)... Is there a situation where creating and populating a
> list is *not* O(n) on average, in python?
"In theory, theory and practice are the same. In practice, they are
not." In other words, constants matter.
Also, the link I had posted earlier [1], shows that tuple creation is
O(1), (at least when it is populated with literals).
[1] http://stackoverflow.com/questions/68630/are-tuples-more-efficient-than-lists-in-python
--
Roshan Mathews
http://teamtalk.im
More information about the BangPypers
mailing list