Yes, as Nayid points out, object references in python can be subtle. Here’s another thread from a while back that gives some examples that are also relevant to the behavior of dictionaries containing array references (also mutable objects), although in that case the point is not to modify the global objects. Please don’t miss this post later in the thread to see another interesting example.
As always in programming, it’s crucial to have both the correct intentions and the correct understanding of the semantics of the language you’re using.