Wrapping around a list

Chris Angelico rosuav at gmail.com
Wed Nov 27 06:14:18 EST 2013


On Wed, Nov 27, 2013 at 10:07 PM, Amjad Syed <amjadcsu at gmail.com> wrote:
> Thanks Chris for the reply. But i would like sliding function to be scalable, as input string can be of 100 letters.

A hundred isn't much to work with, and your code will be fairly
simple. Give it a try with small strings, see how it goes; then try it
on your full-size - I doubt there'll be a problem.

Now, if you were talking about a hundred million letters, then maybe
there'd be a problem. But even there, I'd start with the simple and
clean approach, and only optimize for performance when it becomes
obviously necessary (like when my MUD client was able to saturate one
core of my CPU, just by me typing a lot of commands very rapidly -
that needed fixing!).

ChrisA



More information about the Python-list mailing list