The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

Random832 random832 at fastmail.com
Wed Mar 23 12:24:28 EDT 2016



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.



More information about the Python-list mailing list