[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] coloring book program to try



>> Yes there is.  myList.reverse()
>
> Ahh, I think I'm not using that because it changes the sequence itself
> whereas I want to create a new sequence.. in reverse.. because I need to
> keep the original sequence order for another part of the program.
>
> Michael <mogmios@mlug.missouri.edu>
> http://kavlon.org

You could import the copy module.

###
>>> import copy
>>> alist = [1,2,3]
>>> blist = copy.copy(alist)
>>> blist.reverse()
>>> blist
[3, 2, 1]
>>> alist
[1, 2, 3]
###

Just be sure to read up on the differences between copy.copy and
copy.deepcopy to make sure you use the method you want.

---
Zak Arntson
www.harlekin-maus.com - Games - Lots of 'em