Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'context': 0.05; 'cpython': 0.05; 'completeness': 0.07; 'table.': 0.07; 'python': 0.09; 'dict': 0.09; 'happen.': 0.09; 'received:155': 0.09; 'anyway': 0.11; '"should"': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'ian.': 0.16; 'oct': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:169.70': 0.16; 'received:169.70.184': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'securities,': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; 'pointer': 0.17; 'thu,': 0.17; 'received:169.254': 0.24; 'thus': 0.24; 'header:In-Reply-To:1': 0.25; 'accuracy': 0.27; 'arithmetic': 0.29; 'hash': 0.29; 'received:169': 0.29; 'thursday,': 0.30; 'header:Received:8': 0.30; 'to:addr:python- list': 0.33; 'thanks': 0.34; 'pm,': 0.35; 'subject:': 0.36; 'charset:us-ascii': 0.36; 'keeps': 0.37; 'october': 0.37; 'does': 0.37; 'why': 0.37; 'sent:': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'think': 0.40; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'subject:. ': 0.66; 'purchase': 0.67; 'grow': 0.74; 'sale': 0.76; 'contains.': 0.84; 'received:169.254.8': 0.84; 'to:name:python': 0.84; '1:18': 0.91 X-DKIM: OpenDKIM Filter v2.1.3 sf2.jpmchase.com q9IKQfVO007956 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1350592001; bh=xl3PTkt/Sxzb9qq9cfffAuEqFtRZHckrKQjbXoz2v+E=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=sOj9DNPhJDG/VuB1j13b0Ul3WSmrPomHFFhBP9PRyeu34slnPBYD3eSzxoCn6wNNY kSIBaqLAPHTPgaxqmqdS/b67kPFKXOxtaA/7+BUsLHSCAHUdupTJhyu4eH5EKFCgQL CGk/ib9UWooa/woMbU2SfHIbBByPpl8l8kXA7Qrw= From: "Prasad, Ramit" To: Python Subject: RE: len() on mutables vs. immutables Thread-Topic: len() on mutables vs. immutables Thread-Index: AQHNrVVpw35MazyeyU+GZFCxCjgf6pe/pWYA///KIsCAAEksgP//yf7Q Date: Thu, 18 Oct 2012 20:26:18 +0000 References: <50803B2C.6010900@gmail.com> <5B80DD153D7D744689F57F4FB69AF4741671D06A@SCACMX008.exchad.jpmchase.net> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.79.47] Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-DLP-FWD: Yes Content-Type: text/plain; charset="us-ascii" 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350592004 news.xs4all.nl 6840 [2001:888:2000:d::a6]:55370 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31683 Ian Kelly wrote:=0D=0A> Sent: Thursday, October 18, 2012 2:39 PM=0D=0A> To:= Python=0D=0A> Subject: Re: len() on mutables vs=2E immutables=0D=0A> =0D= =0A> On Thu, Oct 18, 2012 at 1:18 PM, Prasad, Ramit=0D=0A> wrote:=0D=0A> > Why does pointer arithmetic work for dicts?= I would think the position=0D=0A> > of a value would be based on the hash = of the key and thus "random" for=0D=0A> > the context of this conversation= =2E=0D=0A> =0D=0A> It doesn't=2E len() on CPython dicts is O(1) because th= e dict keeps=0D=0A> track of how many items it contains=2E It needs to do = this anyway so=0D=0A> that it can determine when to grow the internal hash = table=2E=0D=0A=0D=0AThat is what I was thinking "should" happen=2E Thanks f= or the =0D=0Aclarification Ian=2E=0D=0A=0D=0A=0D=0ARamit Prasad=0D=0A=0D=0A= =0D=0AThis email is confidential and subject to important disclaimers and= =0D=0Aconditions including on offers for the purchase or sale of=0D=0Asecur= ities, accuracy and completeness of information, viruses,=0D=0Aconfidential= ity, legal privilege, and legal entity disclaimers,=0D=0Aavailable at http:= //www=2Ejpmorgan=2Ecom/pages/disclosures/email=2E