Robert Kern wrote:
> Rob Williscroft wrote:
> 
>> import sys
>>
>> live = 'live'
>>
>> print live[ sys.maxint  :              : -1 ]
>> print live[ len(live)-1 :              : -1 ]
>>
>> print live[ len(live)-1 : -len(live)-1 : -1 ]
>> print live[ len(live)-1 : -sys.maxint  : -1 ]
>> print live[ sys.maxint  : -sys.maxint  : -1 ]
>> print live[ -1          : -len(live)-1 : -1 ]
>>
>> Of course there is only one obvious way to do it, but alas
>> as I'm not Dutch I can't tell which it is.
> 
> 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))?
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to