Reverse a String?
Robert Kern
robert.kern at gmail.com
Sat Sep 23 18:06:26 EDT 2006
Gregory Piñero wrote:
> On 9/23/06, Robert Kern <robert.kern at gmail.com> wrote:
>> Not in that form, no, since this already exists:
>>
>> text[::-1]
>
> Wow, that's really cool! Here are my questions:
>
> 1. How long has this thing been going on? I didn't know slice even
> took an extra argument like that.
Slicing took that "step" argument since 1.4. However, only Numeric arrays used
it up until 2.3 where it was added to the builtin types.
> 2. Where can I get the lowdown on everything there is to know about
> slice? Since I've obviously been living in ignorance all these years!
http://www.python.org/doc/2.3.5/whatsnew/section-slices.html
Generally the "What's New" documents are very good for catching up. I've found
that they're also a very good, high-density method of refreshing one's memory
about useful little tidbits. Sadly, they're not all collected in one place for
that purpose. But you can fake it a bit by replacing <version> in the following
URL with each of 2.2.3, 2.3.5, 2.4.3, 2.5:
http://www.python.org/doc/<version>/whatsnew/
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list