Path: csiph.com!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 10:53:14 -0400 Lines: 19 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 zTheK/O4BAEbJAE1Z+xj2wu5aGehMcGFo7Qwv2j0mAdA== 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; 'received:internal': 0.09; 'situation.': 0.09; 'subject:which': 0.09; 'way:': 0.09; 'thu,': 0.15; 'value.': 0.15; '24,': 0.16; 'conditional': 0.16; 'correctly,': 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; 'unneeded': 0.16; 'variable.': 0.16; 'wrote:': 0.16; 'all,': 0.20; 'header:In-Reply-To:1': 0.24; 'example': 0.26; 'right.': 0.27; 'usually': 0.33; 'item': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'expect': 0.37; 'received:66': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'subject:The': 0.61; 'header :Message-Id:1': 0.61; 'more': 0.63; 'mar': 0.65; 'natural': 0.67 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=jIRuJpfp+DUH7z5k7LWNrUns04s=; b=05pLN1 mV3LLXY94fiL7ujJ/T4jQVeEE96KW+FLJBTAAT35YZP6VPoH4I4wxIjC4Au/RQiC 7fOLCcO9iAOn/a8esSYb1d8qcIb+wqAQpNJMGaBp+DA4K4fvZUuCeDTZWWvSIzh+ MScA5ByxqXglZ+oBK8PpIlQLVJxvYl40rM+s8= 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=jIRuJpfp+DUH7z5 k7LWNrUns04s=; b=kkVPB5yB8kIaN/CKEACxrAi2lGgrJBu1iIzZ7/jMuTT/o1P lGoLXTx6FOzJCKyLHwY6ee8GA4PPF6zi3gdVlOdhfPAZ+4+fyw7KdX1tUP6F5ZUc msYAjqMczsirAsTcn6hSn4vrNmCtYkTFU7RtQbMTU8LdI9nAHNCN+4rbt+ZU= X-Sasl-Enc: cHu6VCAdjcywx3h2byMY8dWQFEpG4EugI2W4F1rK4J7O 1458831194 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:105623 On Thu, Mar 24, 2016, at 10:49, BartC wrote: > On 24/03/2016 14:34, Jussi Piitulainen wrote: > > You understand correctly, but it may be more natural in practice to > > write it this way: > > > > for k, item in enumerate(them): > > them[k] = f(item) > > > > I _think_ I might write it that way even when "f(item)" does not depend > > on the old value at all, but I don't expect to be in that situation. > > > > Yes, you're right. Usually the update is conditional on the existing > value. But my too-simple example would have had an unneeded item > variable. How about them[:] = map(f, them)?