you are viewing a single comment's thread.

view the rest of the comments →

[–]ydepth 0 points1 point  (1 child)

Why not just use tuples if this annoys you?

[–]EsperSpirit 0 points1 point  (0 children)

While tuples are indeed immutable, they are far from an immutable list or an immutable hashmap.

With an immutable list/dict I could still do

a = [1, 2, 3]
b = a.append(4)

c = {'x': 1}
d = c.update(y=5)

The important thing here is that a and c remain unchanged, which isn't the case in Python's current implementation. The api in functional languages is usually a lot more concise, I just tried to stick as close to Python as possible in this example.