Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Dennis Lee Bieber 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:26:57 -0400 Organization: IISS Elusive Unicorn Lines: 37 Message-ID: References: <56ef9787$0$1516$c3e8da3$5496439d@news.astraweb.com> <56f02196$0$1588$c3e8da3$5496439d@news.astraweb.com> <1458750268.3251250.557690202.04DB2EB3@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de OBj7SPXD9Ze4VJByJNchGQp6HcH3/TvV3onXdZhkSHuw== 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; 'character,': 0.07; 'message-id:@4ax.com': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:which': 0.09; 'wed,': 0.15; 'subsequent': 0.15; '2016': 0.16; '23,': 0.16; '>on': 0.16; 'character).': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'selects': 0.16; 'subject:?)': 0.16; 'wrote:': 0.16; 'string': 0.17; 'duplicate': 0.18; 'passes': 0.18; 'url:home': 0.18; 'meant': 0.22; 'lawrence': 0.22; '(where': 0.23; 'header:X -Complaints-To:1': 0.26; 'rest': 0.26; 'function': 0.28; "skip:' 10": 0.28; 'looks': 0.29; '(perhaps': 0.29; 'thinks': 0.29; 'character': 0.29; "i'm": 0.30; "he's": 0.33; 'behind': 0.35; 'could': 0.35; 'something': 0.35; "wasn't": 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'charset :us-ascii': 0.37; 'doing': 0.38; 'why': 0.39; 'goes': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'some': 0.40; 'subject:The': 0.61; 'leading': 0.61; 'mar': 0.65; 'dennis': 0.91; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: adsl-108-73-117-233.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES 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:105579 On Wed, 23 Mar 2016 12:24:28 -0400, Random832 declaimed the following: > > >On Wed, Mar 23, 2016, at 12:08, Mark Lawrence wrote: >> > And doing it 'Pythonically' can lead to suggestions such as the >> > following the other day: >> > >> > c, psource = psource[0], psource[1:] >> > >> > (where psource is a very long string), which even I could tell, from >> > knowing what goes on behind the scenes, wasn't going to work well >> > (duplicating the rest of the string roughly every other character). >> > >> >> It would work perfectly. How would it duplicate the rest of the string >> roughly every other character? > >Er, I think he's suggesting that this would be in an inner loop >(something like while psource: c, psource = psource[0], psource[1:]). >What I'm not sure of is why he thinks this is pythonic. That looks vaguely like something I wrote... And it would have been meant to be in a loop with some other following functions which need the leading single character (perhaps in something like a recursive descent parser) functions[c](psource) which selects the function based upon current character, and passes the rest of the string to the subsequent function. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/