On Tue, 16 Aug 2011 08:15 am Chris Angelico wrote: > On Mon, Aug 15, 2011 at 10:52 PM, Gerrat Rickert > <grick...@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.
The usual term is "shadowing builtins", and it's a feature, not a bug :) > 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. Agreed. It's a style issue, nothing else. There's nothing worse about: def spam(list): pass compared to class thingy: pass def spam(thingy): pass Why should built-ins be treated as more sacred than your own objects? -- Steven -- http://mail.python.org/mailman/listinfo/python-list