Tag Info

New answers tagged


From a theoretical standpoint, yes, the immutability of tuples is the reason for their lack of insert and delete. More accurately, it is the lack of the implementation of methods for insert and delete that makes tuples immutable since Python uses runtime, duck typing for type checking. You call a method on an object and the object will either reply with ...


Yes. The insert and delete operations change an existing object, rather than creating a new one with a different set of elements. Any type that allows those operations is clearly mutable. The equivalent of an insert/delete operation for an immutable type like a tuple would be constructing a new tuple that's only one element different from the original. For ...

Top 50 recent answers are included