[Tutor] cyclically rotate a list.

alan.gauld@bt.com alan.gauld@bt.com
Thu, 14 Feb 2002 14:39:57 -0000


> From: Remco Gerlich [mailto:scarblac@pino.selwerd.nl]
> def rotate(x, y=1):
>    return x[y:] + x[:y]

Oooh, I like it Remco! Much nicer than my loop.

Alan g.