Safe, but for reference types such as lists, dictionaries, and classes, a, b, and c will all point to the same reference, instead of creating three independent variables
When python loads other files, it needs to be explicitly imported before it can import the variables of other files (as long as you are not from XXX import *), so there is no need to worry about the variables of the two files contaminating each other
Safe, but for reference types such as lists, dictionaries, and classes, a, b, and c will all point to the same reference, instead of creating three independent variables
Safe
When python loads other files, it needs to be explicitly imported before it can import the variables of other files (as long as you are not
from XXX import *
), so there is no need to worry about the variables of the two files contaminating each otherA problem arises when using a = b = c = []. The same address is referenced. Modifying the value of a will affect b and c
That’s okay
No problem, this is a syntax unique to Python, equivalent to
And in js it will become
Just distinguish between mutable types and immutable types