What does "::" mean?
Robert Kern
rkern at ucsd.edu
Thu Jul 21 12:59:04 EDT 2005
Michael Hoffman wrote:
> Robert Kern wrote:
>>Well, that part's easy at least:
>>
>> live[::-1]
>>
>>:-) And so the circle is complete ...
>
> What about reversed(live)? Or if you want a list instead of an iterator,
> list(reversed(live))?
That's fine if you want to iterate over it. Often, especially with
strings, you just want an object of the same type back again.
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list