Python itself doesn’t disallow this because there are quite a lot of builtins with useful names - for example, `file`, `id`, and `hash` to name a few. Disallowing setting these would be tantamount to adding a bunch of new keywords to the language, which they’ve been quite loathe to do in general.
A good linter will catch these, so in production environments you usually don’t run into issues. I agree that it can be a beginner trap though!
A good linter will catch these, so in production environments you usually don’t run into issues. I agree that it can be a beginner trap though!