AnyCompiler
← Blog

September 10, 2026

TypeError: 'tuple' object does not support item assignment — What It Means and How to Fix It

If you tried to change a value inside a tuple and Python threw this at you, it's not a bug — it's the entire point of a tuple.

point = (3, 4)
point[0] = 10
Output
Traceback (most recent call last):
  File "script.py", line 2, in <module>
    point[0] = 10
TypeError: 'tuple' object does not support item assignment

Why this happens

A tuple is immutable by design — once created, its contents can never change. Trying to assign to an index (point[0] = 10) is trying to mutate it, and Python refuses outright rather than silently doing something you probably didn't intend.

The fix: use a list instead

point = [3, 4]
point[0] = 10
print(point)
Output
[10, 4]

If a value genuinely needs to change after creation, a list is the right data structure to reach for from the start — not a tuple you're trying to force into behaving like one. And if you only need to replace the whole tuple rather than mutate part of it in place, reassigning the variable to a brand-new tuple (point = (10, point[1])) works too, since that creates a new tuple instead of modifying the old one.

This is also why tuples are the right choice for coordinates, RGB colors, or anything you want a guarantee won't change after creation — see the full Tuples lesson in our free Python course for more on when immutability is a feature, not a limitation.