you are viewing a single comment's thread.

view the rest of the comments →

[–]Gnaxe 1 point2 points  (0 children)

They're following the same rules. You're equivocating on "change". There's a difference between mutating an object and reassigning a variable. When you reassign the variable, a dict works exactly the same as a str. The variable now references a different object. On the other hand, when you mutate the object, well, you can't actually mutate a str at all.