From 16661a9d2cdf9511129f57f3f1f172e80168343c Mon Sep 17 00:00:00 2001 From: Lucas Mirelmann Date: Thu, 25 Dec 2025 00:51:53 +0100 Subject: [PATCH] Fix example The example attempts to do an index assignment on a `range`, this is not allowed as a `range` is immutable. When running the example, it produces the following error: Bazel: "Error: can only assign an element in a dictionary or a list, not in a 'range'" Python: "TypeError: 'range' object does not support item assignment" --- spec.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.md b/spec.md index 7707b3e..358416b 100644 --- a/spec.md +++ b/spec.md @@ -2620,8 +2620,8 @@ A subscript expression appearing on the left side of an assignment causes the specified sequence element or mapping value to be updated: ```python -a = range(10, 13) # a == [10, 11, 12] -a[2] = 7 # a == [10, 11, 7] +a = list(range(10, 13)) # a == [10, 11, 12] +a[2] = 7 # a == [10, 11, 7] coins = {} # coins == {} coins["suzie b"] = 100 # coins == {"suzie b": 100}