Run dir on both of them - a rather different list of methods (pop shown below). tuples can be faster
>>> alist = [1,2,3] >>> atuple = (1,2,3) >>> alist.pop() 3 >>> atuple.pop() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'tuple' object has no attribute 'pop'
'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort' are available for lists, not for tuples. makes sense given the idea of โโimmutability.
Philosophically, some people expect lists to be homogeneous and not have this expectation of tuples.
Alex North-Keys
source share