[Tutor] [Re] Fwd: Strings backwards

Orri Ganel singingxduck at gmail.com
Thu Jan 19 22:49:50 CET 2006

Victor Bouffier wrote:

>I had to do the string-to-list-then-reverse-string-then-back-to-string
>process myself before knowing about this marvelous operand.
>It works on tuples (all immutable objects) too:

Not all immutable objects, just those that define __getslice__ 
(basically, those that use indexes: sequences).  Ints, for example, are 
immutable and don't work:

 >>> 12[::-1]

Traceback (most recent call last):
  File "<pyshell#23>", line 1, in -toplevel-
TypeError: unsubscriptable object

 - Orri

Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.

More information about the Tutor mailing list