[Tutor] [Re] Fwd: Strings backwards
Victor Bouffier
victor at grupocdm.com
Sun Jan 22 00:57:48 CET 2006
On Thu, 2006-01-19 at 16:49 -0500, Orri Ganel wrote:
> 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:
> >
> [SNIP]
>
> 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-
> 12[::-1]
> TypeError: unsubscriptable object
>
>
> - Orri
>
I see.
Thanks for the correction Orri
Victor
More information about the Tutor
mailing list