rick <[EMAIL PROTECTED]> writes: > Why can't Python have a reverse() function/method like Ruby? > > Python: > x = 'a_string' > # Reverse the string > print x[::-1] > > The Ruby approach makes sense to me as a human being. The Python > approach is not easy for me (as a human being) to remember. Can that > be changed or should I just start blindly memorizing this stuff?
You could use: print ''.join(reversed(x)) That also looks a little bit weird, but it combines well-known Python idioms straightforwardly. -- http://mail.python.org/mailman/listinfo/python-list