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
--
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor