4
I’m studying Python and in these studies I came across something curious.
> False = True
#Imprime: True
> print(False)
#Imprime: True
> False = bool(0)
> print(False)
#Imprime: False
I mean, I was able to rewrite the value of False giving him the value of True.
In languages such as javascript or PHP cannot be reallocated because False is a language constructor or even a constant.
Why in the Python is it possible to do this? How is it treated False in Python? As a variable?
Python implements two essential concepts, Space of Names and Space of Objects. What happens then is that you modified the value of the True/False object then changed the Object in Object Space. So when creating a variable that uses this object, the variable will use the new value and not the original.
– urb