Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.023 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.06; 'builtin': 0.09; 'dan': 0.09; 'objects,': 0.09; 'cc:addr:python- list': 0.11; 'dict': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'keys.': 0.16; 'once.': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; "i've": 0.25; 'references': 0.26; 'header :In-Reply-To:1': 0.27; 'function': 0.29; 'message- id:@mail.gmail.com': 0.30; 'fri,': 0.33; 'received:google.com': 0.35; 'pm,': 0.38; 'rather': 0.38; 'even': 0.60; 'ian': 0.60; 'hang': 0.67; '2015': 0.84; 'case?': 0.84; 'ever.': 0.84; 'subject:Practices': 0.84; 'to:none': 0.92 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:cc :content-type; bh=CL/92rgVt+kgndQF41ay9JTsQkWskAw19kAmUPs/mfg=; b=d5dYa8TE0fuqyNV7CA7KYNd2Y0SBlR6DgJ6wfAO6VQD880macsVCemDkDSucpw8VM6 QrmPA6FAliu8ugvvDD8gsaqQ0VPmwFt6bU7r9l+Hzs6tXdg5vzl0IIHMFlKKk/7MXyYf kdZiOv/aQBEoHTEm+ZYf8b1PBVHwgDSAj2g152JKizK2MgHOYwlAenoRS0J36ShRUzqO EqMaBmffgsQ2DAmTVmpgHm73xC1d1lP9GuqN9kR8Xt3Jhv2unt8tLstt4/PvawwAgTxF TpvKnU3V5l7LHXfFQEidqf6JG9bwXVj2NZfSilY6tUXySrESIJ48ISKJxuq1RJQipfKe AHKw== MIME-Version: 1.0 X-Received: by 10.50.79.161 with SMTP id k1mr9702698igx.14.1425113905530; Sat, 28 Feb 2015 00:58:25 -0800 (PST) In-Reply-To: References: <54f1154c$0$12985$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 28 Feb 2015 19:58:25 +1100 Subject: Re: Python Worst Practices From: Chris Angelico Cc: Python Content-Type: text/plain; charset=UTF-8 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1425113912 news.xs4all.nl 2900 [2001:888:2000:d::a6]:47019 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86615 On Sat, Feb 28, 2015 at 7:48 PM, Ian Kelly wrote: > On Fri, Feb 27, 2015 at 9:42 PM, Dan Sommers wrote: >> I don't think I've ever used the builtin function id in a program. >> Ever. Not even once. Honestly, what is a valid use case? > > If you have a dict that you want to key on object identity rather than > equality, then you can use object ids as the keys. And not forget to hang onto references to all those objects, else their ids will be meaningless. ChrisA