Paul Boddie wrote:
> James Stroud wrote:
>>(1,2,3).reversed()
>>
>>"123".reversed()
>>
>>[1,2,3].reversed()
 >
> I guess Python 2.5 has the reversed method of which you speak.

Not that I could find (as methods of any built in sequence type). 2.5 
just has the "reversed" function that returns and iterator and so 2.5 
requires these kind of gymnastics on built in sequences:

> "".join(list(reversed(list(s))))

Of course, I think str.join can operate on iterators, as Paul Rubin 
suggests:

 > print ''.join(reversed(x))

This latter approach still seems a little clunky, though.

James


-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to