As you’ve found out, there are no such things as constants in Python.
There are other oddities that people used to other languages find weird at first. No such thing as private variables in a class or module. Just about everything happens to be a variable of some kind. No enums (though there are neat tricks to simulate enums).
For fun, you can also define functions inside other functions:
>>> def some_fn():
... x = 1
... def _some_other_fn():
... print x
... _some_other_fn()
...
>>> some_fn()
1
Functions can actually be treated like variables too.
>>> def fn():
... pass
...
>>> x = fn
>>> x
<function fn at 0x7ffe4c917578>
>>> x.y = 1
>>> x
<function fn at 0x7ffe4c917578>
>>> x.y
1
But, to actually answer your question, this SO post has a reasonable set of answers about Python’s scoping rules.