Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11475
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <philip@semanchuk.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'assign': 0.04; 'instance': 0.05; 'warnings': 0.05; 'builtins': 0.07; 'compiler': 0.07; 'differently.': 0.07; 'interpreter': 0.07; 'names.': 0.07; 'subject:when': 0.07; 'suggesting': 0.07; 'variable,': 0.07; 'python': 0.08; '__future__': 0.09; 'eclipse': 0.09; 'overwrite': 0.09; 'folks': 0.15; 'result,': 0.15; '"from': 0.16; '(eg.': 0.16; 'keyword,': 0.16; 'received:mindspring.com': 0.16; 'subject:builtin': 0.16; 'surprising': 0.16; 'x-mailer:apple mail (2.1084)': 0.16; 'syntax': 0.16; 'wrote:': 0.16; 'language': 0.17; 'later': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'pm,': 0.24; 'aug': 0.24; 'code.': 0.26; 'helpful': 0.26; "i'm": 0.27; 'import': 0.28; 'anyway.': 0.29; 'explicitly': 0.29; 'fairly': 0.30; 'accidentally': 0.30; "they'll": 0.30; 'class': 0.30; 'subject:?': 0.31; 'seem': 0.31; 'list': 0.32; 'received:24': 0.32; 'actual': 0.32; 'break': 0.32; 'agree': 0.33; 'it.': 0.33; 'actually': 0.33; 'to:addr:python-list': 0.33; 'that,': 0.33; 'project': 0.34; 'weird': 0.34; 'charset:us-ascii': 0.36; 'problem.': 0.36; 'skip:" 10': 0.36; 'example,': 0.37; 'class.': 0.37; 'but': 0.37; 'something': 0.37; 'could': 0.38; 'think': 0.38; 'some': 0.38; 'should': 0.38; 'subject:: ': 0.39; 'difficult': 0.39; 'enough': 0.39; 'help': 0.39; 'header:Mime- Version:1': 0.39; 'user': 0.39; "there's": 0.39; 'to:addr:python.org': 0.39; 'might': 0.40; "it's": 0.40; 'header :Message-Id:1': 0.61; 'postings': 0.64; 'cause': 0.67; 'receive': 0.67; 'often.': 0.84; 'received:69.73': 0.84; 'regard.': 0.84; 'regularity,': 0.84; 'warning.': 0.84 |
| Content-Type | text/plain; charset=us-ascii |
| Mime-Version | 1.0 (Apple Message framework v1084) |
| Subject | Re: Why no warnings when re-assigning builtin names? |
| From | Philip Semanchuk <philip@semanchuk.com> |
| In-Reply-To | <BB13E4C4D649234F84A01F6DF64BB87F076AD0CE@ccs-ex01.coldstorage.com> |
| Date | Mon, 15 Aug 2011 18:13:02 -0400 |
| Content-Transfer-Encoding | quoted-printable |
| References | <BB13E4C4D649234F84A01F6DF64BB87F076AD0CE@ccs-ex01.coldstorage.com> |
| To | Lista-Comp-Lang-Python list <python-list@python.org> |
| X-Mailer | Apple Mail (2.1084) |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - deimos.nocdirect.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - semanchuk.com |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.21.1313446389.27778.python-list@python.org> (permalink) |
| Lines | 42 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1313446389 news.xs4all.nl 23886 [2001:888:2000:d::a6]:34747 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:11475 |
Show key headers only | View raw
On Aug 15, 2011, at 5:52 PM, Gerrat Rickert 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. > > ...and if they're _unlucky_ enough, their program may actually work > (encouraging them to re-use this name in other programs). Or they'll assign a class instance to 'object', only to cause weird errors later when they use it as a base class. I agree that this is a problem. The folks on my project who are new-ish to Python overwrite builtins fairly often. Since there's never been any consequence other than my my vague warnings that something bad might happen as a result, it's difficult for them to develop good habits in this regard. It doesn't help that Eclipse (their editor of choice) doesn't seem to provide a way of coloring builtins differently. (That's what I'm told, anyway. I don't use it.) > If they try to use an actual keyword, both the interpreter and compiler > are helpful enough to give them a syntax error, but I think the builtins > should be "pseudo-reserved", and a user should explicitly have to do > something *extra* to not receive a warning. Unfortunately you're suggesting a change to the language which could break existing code. I could see a use for "from __future__ import squawk_if_i_reassign_a_builtin" or something like that, but the current default behavior has to remain as it is. JMO, Philip
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Why no warnings when re-assigning builtin names? Philip Semanchuk <philip@semanchuk.com> - 2011-08-15 18:13 -0400 Re: Why no warnings when re-assigning builtin names? rantingrick <rantingrick@gmail.com> - 2011-08-15 18:12 -0700
csiph-web