rick <ath-admin at vt.edu> 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.