Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31683

RE: len() on mutables vs. immutables

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 <ramit.prasad@jpmorgan.com>
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" <ramit.prasad@jpmorgan.com>
To Python <python-list@python.org>
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> <k5phqe$2ia$1@ger.gmane.org> <5B80DD153D7D744689F57F4FB69AF4741671D06A@SCACMX008.exchad.jpmchase.net> <CALwzid==JD-mxv_okmhfC-nL+Yx8Dj6FYGCyRPGbsL3cmjGt2A@mail.gmail.com>
In-Reply-To <CALwzid==JD-mxv_okmhfC-nL+Yx8Dj6FYGCyRPGbsL3cmjGt2A@mail.gmail.com>
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 <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.2473.1350592004.27098.python-list@python.org> (permalink)
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

Show key headers only | View raw


Ian Kelly wrote:
> Sent: Thursday, October 18, 2012 2:39 PM
> To: Python
> Subject: Re: len() on mutables vs. immutables
> 
> On Thu, Oct 18, 2012 at 1:18 PM, Prasad, Ramit
> <ramit.prasad@jpmorgan.com> wrote:
> > Why does pointer arithmetic work for dicts? I would think the position
> > of a value would be based on the hash of the key and thus "random" for
> > the context of this conversation.
> 
> It doesn't.  len() on CPython dicts is O(1) because the dict keeps
> track of how many items it contains.  It needs to do this anyway so
> that it can determine when to grow the internal hash table.

That is what I was thinking "should" happen. Thanks for the 
clarification Ian.


Ramit Prasad


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

RE: len() on mutables vs. immutables "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-10-18 20:26 +0000

csiph-web