Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #47636
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jason.swails@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.009 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; '(especially': 0.07; '[0,': 0.09; 'builtin': 0.09; 'try:': 0.09; 'subject:question': 0.10; 'cc:addr:python-list': 0.11; 'jan': 0.12; '20]': 0.16; 'builtins': 0.16; 'cc:name:python list': 0.16; 'email addr:udel.edu>': 0.16; 'email name:<tjreedy': 0.16; 'extraneous': 0.16; 'reedy': 0.16; 'subject:class': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; '<': 0.19; 'replacing': 0.19; '>>>': 0.22; 'input': 0.22; 'memory': 0.22; 'hack': 0.22; 'cc:addr:python.org': 0.22; '\xa0if': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; '>>>>': 0.31; 'python).': 0.31; 'another': 0.32; 'beginning': 0.33; 'except': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'doubt': 0.36; 'subject:regarding': 0.36; 'done': 0.36; 'similar': 0.36; 'starting': 0.37; 'pm,': 0.38; 'does': 0.39; '8bit%:6': 0.40; 'dave': 0.60; 'took': 0.61; 'range': 0.61; "you're": 0.61; 'first': 0.61; 'times': 0.62; 'hours': 0.66; 'yes': 0.68; 'find.': 0.84; 'angel': 0.91; 'edwards': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iyYTuWu2qnT+fOsU/oOz4Ig1s6WNkZjA6aDRrBbV55A=; b=v52fy8vhOSNTBBT0NLokWSvrB073ip3gtS2HhR1HPmxv6QN5C2TjCI8+aPmR78uqDM paOkXntPTeeWKLT5NA+4yeBpZBkAxmoKakUmEj5t79HEHzHXCgydC3M0d59bI70fZ1gl EQsXADVQ2phtvg4g5FSTwYI0xfkk2Ar8yLmx7YEJfWW9vuchsNnY8lz3QbofdpNCz/3k JPe4VdPNEcdekpTxxY6mqGSN0yJsbugUpjWdyQSHJOOI8GAUWWoMjTua9z4vS6Eu/uvi b6m2ZrPVX1sCIyhNl0f9wG6zWvpcfbElLtmkE+dwHG3TD+oNx399r20TRZx9Pvu8kAlR +5dA== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.1.70 with SMTP id 6mr7053igk.54.1370922552798; Mon, 10 Jun 2013 20:49:12 -0700 (PDT) |
| In-Reply-To | <51B6609A.4050506@davea.name> |
| References | <kp4jf4$5fu$1@dont-email.me> <mailman.2967.1370872174.3114.python-list@python.org> <kp4lrg$hfi$2@dont-email.me> <mailman.2969.1370874511.3114.python-list@python.org> <kp4o3u$pv$1@dont-email.me> <mailman.2970.1370876729.3114.python-list@python.org> <kp4qi6$dno$1@dont-email.me> <mailman.2972.1370879753.3114.python-list@python.org> <kp4tf4$1on$1@dont-email.me> <mailman.2983.1370893881.3114.python-list@python.org> <kp5bot$sh2$1@dont-email.me> <mailman.2988.1370902047.3114.python-list@python.org> <kp5kjd$ppk$1@reader1.panix.com> <CAPTjJmosRs7gXrQ12ph1+Yg1dcsFNzykdP=3j0NFj1tedpiBjw@mail.gmail.com> <51B6609A.4050506@davea.name> |
| Date | Mon, 10 Jun 2013 23:49:12 -0400 |
| Subject | Re: Newbie: question regarding references and class relationships |
| From | Jason Swails <jason.swails@gmail.com> |
| To | Dave Angel <davea@davea.name> |
| Content-Type | multipart/alternative; boundary=047d7bd6c730c642d904ded8c735 |
| Cc | python list <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.3006.1370922555.3114.python-list@python.org> (permalink) |
| Lines | 136 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1370922555 news.xs4all.nl 15977 [2001:888:2000:d::a6]:49294 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:47636 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Mon, Jun 10, 2013 at 7:26 PM, Dave Angel <davea@davea.name> wrote:
> On 06/10/2013 06:54 PM, Chris Angelico wrote:
>
>> On Tue, Jun 11, 2013 at 8:39 AM, Grant Edwards <invalid@invalid.invalid>
>> wrote:
>>
>>> On 2013-06-10, Terry Jan Reedy <tjreedy@udel.edu> wrote:
>>>
>>> Another principle similar to 'Don't add extraneous code' is 'Don't
>>>> rebind builtins'.
>>>>
>>>
>>> OK, we've all done it by accident (especially when starting out), but
>>> are there people that rebind builtins intentionally?
>>>
>>
>> There are times when you don't care what you shadow, like using id for
>> a database ID.
>>
>> ChrisA
>>
>>
> And times where you're deliberately replacing a built-in
>
> try:
> input = raw_input
> except ....
Yes but this is a hack to coerce Python2/3 compatibility. You're no doubt
correct that it's intentional rebinding with a definite aim, but if the
PyArchitects had their way, this would be unnecessary (and discouraged) as
well.
The first time I remember rebinding a builtin was completely accidental
(and at the very beginning of me learning and using Python).
# beginner's crappy code
range = [0, 20]
# bunches of code
for i in range(len(data)):
if data[i] > range[0] and data[i] < range[1]:
do_something
TypeError: 'list' object is not callable... # what the heck does this mean??
That one drove me nuts. Took me hours to find. I still avoid rebinding
builtins just from the memory of the experience :)
--Jason
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 14:18 +0100
Re: Newbie: question regarding references and class relationships Roy Smith <roy@panix.com> - 2013-06-10 09:35 -0400
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 14:57 +0100
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 15:00 +0100
Re: Newbie: question regarding references and class relationships Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-10 13:56 -0600
Re: Newbie: question regarding references and class relationships Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-11 17:02 -0700
Re: Newbie: question regarding references and class relationships Peter Otten <__peter__@web.de> - 2013-06-10 15:49 +0200
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 14:59 +0100
Re: Newbie: question regarding references and class relationships Peter Otten <__peter__@web.de> - 2013-06-10 16:28 +0200
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 15:38 +0100
Re: Newbie: question regarding references and class relationships Peter Otten <__peter__@web.de> - 2013-06-10 17:05 +0200
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 16:20 +0100
Re: Newbie: question regarding references and class relationships Peter Otten <__peter__@web.de> - 2013-06-10 17:55 +0200
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 17:09 +0100
Re: Newbie: question regarding references and class relationships Peter Otten <__peter__@web.de> - 2013-06-10 19:07 +0200
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 18:42 +0100
Re: Newbie: question regarding references and class relationships Dave Angel <davea@davea.name> - 2013-06-10 15:36 -0400
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 21:31 +0100
Re: Newbie: question regarding references and class relationships Terry Jan Reedy <tjreedy@udel.edu> - 2013-06-10 15:51 -0400
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 21:13 +0100
Re: Newbie: question regarding references and class relationships Terry Jan Reedy <tjreedy@udel.edu> - 2013-06-10 18:07 -0400
Re: Newbie: question regarding references and class relationships Grant Edwards <invalid@invalid.invalid> - 2013-06-10 22:39 +0000
Re: Newbie: question regarding references and class relationships Chris Angelico <rosuav@gmail.com> - 2013-06-11 08:54 +1000
Re: Newbie: question regarding references and class relationships Tim Chase <python.list@tim.thechases.com> - 2013-06-10 18:24 -0500
Re: Newbie: question regarding references and class relationships Dave Angel <davea@davea.name> - 2013-06-10 19:26 -0400
Re: Newbie: question regarding references and class relationships Jason Swails <jason.swails@gmail.com> - 2013-06-10 23:49 -0400
Re: Newbie: question regarding references and class relationships Terry Jan Reedy <tjreedy@udel.edu> - 2013-06-10 15:54 -0400
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 21:09 +0100
Re: Newbie: question regarding references and class relationships Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-11 16:50 -0700
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-13 13:06 +0100
Re: Newbie: question regarding references and class relationships Chris Angelico <rosuav@gmail.com> - 2013-06-14 00:07 +1000
Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-13 19:23 +0100
csiph-web