On Sun, May 26, 2013 at 12:17 PM, RVic <rvinc...@gmail.com> wrote:
> Ah, brilliant -- yes, this is so much more elegant in Python:
>
> #now cut the cards
> x = random.randrange(2,range(13 * 4 * decks))
> cards = cards[x:]+cards[:x]

Or if for some reason you want to do it in place:

cards[x:], cards[:x] = cards[:x], cards[x:]

But note that the order of assignments is subtly important there, so
unless you have a good reason for doing that, it's probably better
just to create a new list for clarity.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to