Why no warnings when re-assigning builtin names?
Chris Angelico
rosuav at gmail.com
Mon Aug 15 18:15:01 EDT 2011
On Mon, Aug 15, 2011 at 10:52 PM, Gerrat Rickert
<grickert at coldstorage.com> wrote:
> With surprising regularity, I see program postings (eg. on StackOverflow)
> from inexperienced Python users accidentally re-assigning built-in names.
>
> For example, they’ll innocently call some variable, “list”, and assign a
> list of items to it.
It's actually masking, not reassigning. That may make it easier or
harder to resolve the issue.
If you want a future directive that deals with it, I'd do it the other
way - from __future__ import mask_builtin_warning or something - so
the default remains as it currently is. But this may be a better job
for a linting script.
ChrisA
More information about the Python-list
mailing list