Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'interpreter': 0.05; '(especially': 0.07; 'variables': 0.07; "(i'd": 0.09; 'exit': 0.09; 'subject:question': 0.10; 'cc:addr:python-list': 0.11; 'missed': 0.12; "wouldn't": 0.14; '-tkc': 0.16; 'builtins': 0.16; 'deprecated,': 0.16; 'extraneous': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'scope,': 0.16; 'subject:class': 0.16; 'wrote:': 0.18; 'module': 0.19; 'input': 0.22; 'cc:addr:python.org': 0.22; 'alternate': 0.24; 'certainly': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'especially': 0.30; 'convenience': 0.31; 'another': 0.32; 'convert': 0.35; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'subject:regarding': 0.36; 'done': 0.36; 'charset:us-ascii': 0.36; 'similar': 0.36; 'list': 0.37; 'easily': 0.37; 'starting': 0.37; 'e.g.': 0.38; 'filter': 0.38; 'expect': 0.39; 'called': 0.40; 'most': 0.60; 'times': 0.62; 'more': 0.64; 'needing': 0.65; 'to:addr:gmail.com': 0.65; 'license': 0.66; 'common,': 0.84; 'received:50.22': 0.84 Date: Mon, 10 Jun 2013 18:24:34 -0500 From: Tim Chase To: Chris Angelico Subject: Re: Newbie: question regarding references and class relationships In-Reply-To: References: X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com Cc: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370906564 news.xs4all.nl 15930 [2001:888:2000:d::a6]:43899 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47618 On 2013-06-11 08:54, Chris Angelico 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. While that's certainly the most common, there are a lot of items in __builtins__ that are there for convenience that I wouldn't think twice about rebinding, especially in a local scope (I might take more care at a module scope, but still wouldn't care much). E.g. apply bin buffer coerce filter format input Some are deprecated, some are easily replaced by (what I consider more readible) list comprehensions, and some have alternate meanings that might be the right word-choice inside a function and wouldn't be missed (I'd expect to see a bin-sort function use variables called "bin" and not needing to convert from integer-to-string) And some strings that are harmless outside the interactive interpreter copyright credits exit license quit -tkc