Re: [Tutor] question about the build-in function reversed in Python2.5

2011-12-25 Thread Steven D'Aprano
daedae11 wrote: The build-in function reversed() in Python2.5 returns a iterator. But I don't know how to use the iterator. Please give me a simple example about how to use bulid-in function reversed() to reverse a list. You use the iterator the same way you would any other iterator: * in f

Re: [Tutor] question about the build-in function reversed in Python2.5

2011-12-24 Thread bob gailer
On 12/25/2011 12:02 AM, daedae11 wrote: The build-in function reversed() in Python2.5 returns a iterator. But I don't know how to use the iterator. Please give me a simple example about how to use bulid-in function reversed() to reverse a list. >>> [x for x in reversed([1,2,3])] [3, 2, 1] >>

[Tutor] question about the build-in function reversed in Python2.5

2011-12-24 Thread daedae11
The build-in function reversed() in Python2.5 returns a iterator. But I don't know how to use the iterator. Please give me a simple example about how to use bulid-in function reversed() to reverse a list. Thank you in advance. daedae11___ Tutor m