News for hackers. Stuff that matters.
Re:C++11 and Boost - Succinct like Python by BoppreH on Wednesday October 31, 2012 @01:01PM (#4723851)
Or you could use the "reversed" built-in function:

  s = "string"
  reversed(s)
It also has the plus of creating a generator, saving memory from a new array allocation.
Re:C++11 and Boost - Succinct like Python by wting on Wednesday October 31, 2012 @01:18PM (#4723962)
`reversed(s)` returns an iterator. The much slower equivalent of `s[::-1]` is `''.join(reversed(s))`.

It's odd how Python has list.reverse() but not str.reverse(). Probably a conscious design decision sometime ago.

Re:C++11 and Boost - Succinct like Python by ot on Wednesday October 31, 2012 @01:22PM (#4723994)
list is mutable while str is not. So reverse() should return a new copy, but it would duplicate the functionality of s[::-1] (which is quite idiomatic, although a bit obscure)