Allowing += to be used with value from hash #12427
mitchgrout
started this conversation in
General
Replies: 2 comments 8 replies
-
Addendum, this is also currently not possible: cfg['extra'] = 42 with a similar message:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Dictionaries are immutable, so the assignment in your reply can't work. Arrays are also immutable, and adding to them only creates a new object. So these two things together means |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Consider the following fragment:
Evaluating this will provide the following error
Is this intentional, or an oversight in the grammar/interpreter? It provides a nice way to represent data clumps (e.g. variables that do not make sense without each other), and is otherwise expressible with the more awkward
My suspicion is that the grammar specifies that
+=
is only allowed on variable-ish things, andvar[subscript]
is not recognized as variable-ish. Could this be changed?Beta Was this translation helpful? Give feedback.
All reactions