From: Terry Reedy on 1 Jul 2010 21:18 On 7/1/2010 3:54 AM, Stephen Hansen wrote: > On 7/1/10 12:45 AM, Terry Reedy wrote: >> On 7/1/2010 12:32 AM, Mladen Gogala wrote: >>> On Wed, 30 Jun 2010 21:04:28 -0700, Stephen Hansen wrote: >> >>>> However, you can easily get what you want by using the 'reversed' >>>> function (and similarly, the 'sorted' function), a la: >>>> >>>> >>> y = ''.join(reversed(list(x))) >>>> >>>> The 'reversed' and 'sorted' functions are generators that lazilly >>>> convert an iterable as needed. >>> >>> Ah, that is even better. Thanks. >> >> It is better if you do not mind making an unnecessary copy. If the list >> had 10 million elements, you might prefer your original. > > The original that did not work? :) The revised original that did work with sequential statements. -- Terry Jan Reedy
First
|
Prev
|
Pages: 1 2 3 Prev: automate minesweeper with python Next: Very odd output from subprocess |