John, Thanks. Your message was very helpful. I will tattoo it to my forehead. hehe... i notice that the "learning python" book also explains so of this and i shall study that as well....
cheers, kevin On Apr 27, 2006, at 10:14 PM, [EMAIL PROTECTED] wrote: > > On 28/04/06, kevin parks <[EMAIL PROTECTED]> wrote: >> In most case you are fine operating on the list in place and altering >> the >> existing list. In some cases you want your code to stop molesting >> your poor >> mutables and really honestly sincerly copy the dang thing. In this >> case i am >> making a function that does odd smmetry mirroring. But i want my >> orginal list >> to remain intact.... >> >> def mirror(seq): >> """odd symmetry mirroring [1, 2, 3, 4] --> [1, 2, 3, 4, 3, >> 2, 1]""" >> foo=seq[:-1] # copy list, >> excluding last element for odd symetry >> foo.reverse() # flip it >> seq.extend(foo) >> return seq > > Hi Kevin, > > Your problem is this line: > seq.extend(foo) _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor