This has nothing to do with either dynamic or weak typing in Python. It's just Python not disambiguating between shadowing and reassignment.
Here's a comment of mine that explains why Python is weakly typed: https://news.ycombinator.com/item?id=26354039.