invert or reverse a string... warning this is a rant

James Stroud jstroud at mbi.ucla.edu
Thu Oct 19 13:56:37 EDT 2006


John Salerno wrote:
> rick wrote:
> 
>> Why can't Python have a reverse() function/method like Ruby?
> 
> 
> I'm not steeped enough in daily programming to argue that it isn't 
> necessary, but my question is why do you need to reverse strings?

It would provide symmetry for reversing any sequence (without requiring 
an iterator).

(1,2,3).reversed()

"123".reversed()

[1,2,3].reversed()



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

http://www.jamesstroud.com/



More information about the Python-list mailing list