Path: csiph.com!weretis.net!feeder4.news.weretis.net!news.tal.de!news.wtal.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?) Date: Thu, 24 Mar 2016 11:30:55 -0400 Lines: 16 Message-ID: References: <56e7483d$0$1608$c3e8da3$5496439d@news.astraweb.com> <56ef9787$0$1516$c3e8da3$5496439d@news.astraweb.com> <56f02196$0$1588$c3e8da3$5496439d@news.astraweb.com> <56f3f09a$0$1595$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de JMHYfZphUD1atBsgfbaOjQu4CcX2CsbOOaGIIpoNH/Uw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'received:internal': 0.09; 'subject:which': 0.09; 'thu,': 0.15; '24,': 0.16; 'in-place,': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'subject:?)': 0.16; 'wrote:': 0.16; 'memory': 0.17; 'elements': 0.23; 'references': 0.23; 'replacing': 0.23; 'header :In-Reply-To:1': 0.24; "skip:' 10": 0.28; 'sure,': 0.29; "i'm": 0.30; 'e.g.': 0.30; 'that,': 0.34; 'list': 0.34; 'replace': 0.35; 'but': 0.36; 'list,': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'really': 0.37; 'received:66': 0.38; 'to:addr:python.org': 0.40; 'care': 0.60; 'subject:The': 0.61; 'header:Message-Id:1': 0.61; 'mar': 0.65; 'occupied': 0.84 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=TPIQrqg34/7MZ/InCQ/bvGwBQlU=; b=jsseQo L8LhW1sKbh4Xt7eOkd9HM60ld/nKWWj77tZdHYoICU2wWnTjLnzYN71EydVwDLMc fSZ6q29QHZhtamNxftMKjRZNjRW5Qysomdkopsq7l9QkpBG5KlioMshkIO/Z/pQ/ tFlA4jKOQqS4+yQBYQYwOFxJnhJji7ZTNO1YE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=TPIQrqg34/7MZ/I nCQ/bvGwBQlU=; b=ZqMqghV483rTDiH0MX3BMYbtkz/C1AiRiQPeiRoslGqSj6j 7D22AfWEodrbsgy0N5SWVbl5EFWzprwLYG6vfywX8s93GCP/KYZIzbvJOeoB523F urd57ibCZrvs3rRM/WK0ElA0k2RddRMBsVgUqlyONuKThZhdsyGRwWPrEei0= X-Sasl-Enc: hRQeTF+mKS7Icwp4+LR9LF3F+3q9D1xzEc3rtivmrjvA 1458833455 X-Mailer: MessagingEngine.com Webmail Interface - ajax-eaa4717d In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105630 On Thu, Mar 24, 2016, at 11:18, BartC wrote: > On 24/03/2016 15:03, Jon Ribbens wrote: > > No it isn't, it's replacing the elements in-place, > > Replace them with what, if not an entirely new list built from > '[0]*len(L)'? Well, the *contents* of such a list, obviously. But the original list's contents are replaced, meaning that e.g. all other references to the list remain valid etc. > (And which would briefly require twice the memory occupied > by the old list, if I'm not mistaken.) Sure, *briefly*. And if you really care about that, you can do L[:] = (0 for x in L); or itertools.repeat(0, len(L)).