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: Wed, 23 Mar 2016 20:12:12 -0400 Lines: 27 Message-ID: References: <56e44258$0$1598$c3e8da3$5496439d@news.astraweb.com> <8737rvxs89.fsf@elektro.pacujo.net> <56e7483d$0$1608$c3e8da3$5496439d@news.astraweb.com> <56ef9787$0$1516$c3e8da3$5496439d@news.astraweb.com> <56f02196$0$1588$c3e8da3$5496439d@news.astraweb.com> <56f32cff$0$1602$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de qriE8//hfrcra61ZzGY3WAvgsQRISff0IGxHdUF0g6ZQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'pop': 0.05; 'file)': 0.07; 'received:internal': 0.09; 'stringio': 0.09; 'subject:which': 0.09; 'python': 0.10; 'wed,': 0.15; '23,': 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; 'true:': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'string': 0.17; 'string,': 0.18; '(the': 0.22; 'for?': 0.23; 'header:In-Reply-To:1': 0.24; 'sense': 0.26; 'question': 0.27; 'loop,': 0.29; 'tail': 0.29; 'them?': 0.29; 'thinks': 0.29; 'code': 0.30; 'guess': 0.31; 'class': 0.33; 'source': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'skip:d 20': 0.34; "isn't": 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'received:66': 0.38; 'copying': 0.38; 'why': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'care': 0.60; 'your': 0.60; 'subject:The': 0.61; 'header :Message-Id:1': 0.61; 'eye': 0.61; 'real': 0.62; 'further': 0.62; 'more': 0.63; 'world': 0.64; 'mar': 0.65; 'handing': 0.84; 'proves': 0.84; 'dennis': 0.91 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=mbZPBqIVHokKfOpasuZWLK5QrCs=; b=NnmXtK ru5dR0JqwWEhXBk5vWvrnIPQpmmooR4sLzftLVTqrn8uxH/QXsN7fJ4/HuJhAy+Z aQTf0jGEEu+9L5uAerlsHdUtCBC6MM8+lldVQvVH9abo0wGYgNBUoFvxw16NsElM Y/IFFRnp+Pg2v+b+2qsRVmCNGGkLXqA3FW518= 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=mbZPBqIVHokKfOp asuZWLK5QrCs=; b=Btm6xjNMt7U5XaHwJIHjdTme1gYcgTs6y/CNuWvcWMbdqyn ZsbbIIyb/cDguJ8d3z1Jh7PneMfYke9GDOFCscCuRbcSAuCodIxf6IZRBueiiBK6 HCz0o8lPGrmHaJBmEQ0HANR4k4wi8Y/oihqQcVzFXzv2VJslY1m+G72jf+WU= X-Sasl-Enc: Isr/ycSsSSYbOofHoDivUihruvvlR0+IRKpojhYX+Lc1 1458778332 X-Mailer: MessagingEngine.com Webmail Interface - ajax-eaa4717d In-Reply-To: <56f32cff$0$1602$c3e8da3$5496439d@news.astraweb.com> 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:105576 On Wed, Mar 23, 2016, at 19:55, Steven D'Aprano wrote: > while psource: > c, psource = psource[0], psource[1:] > lxsymbol = disptable[min(ord(c), 256)](c, psource) > > > But one positive: this conclusively proves that "Pythonic" is in the eye > of > the beholder. Dennis thinks that c, psource = psource[0], psource[1:] is > reasonable Python code; you think it's not ("I'm not sure why [Bart] > thinks > this is pythonic"). I guess the question is, what do you _actually_ need the tail string for? If you're using it in a loop, to pop further characters from (the scenario that would cause it to be copying the string over lots of times), wouldn't it make more sense to use a StringIO (or, in the real world where your C source code isn't a string, a file) and let that class take care of handing out characters when you ask for them? Like... fsource = StringIO(psource) while True: c = fsource.read(1) lxsymbol = disptable[min(ord(c), 256)](c, fsource)