Peter Otten wrote:
[EMAIL PROTECTED] wrote:


so if I want to reverse it fully using s[len(s)-1:x:-1] what would x be
or is it impossible to express it in this way ?


This does not work for integers, because the theoretically correct value x = -1 already has another interpretation as the gap between the last and
the last but one character.
AFAIK, it is not an issue of integer (what else can an slice index be in python?) but simply of index aliasing.

For x=-len(s)-1, you get the whole reversed list:

In [5]: s[len(s)-1:-len(s)-1:-1]
Out[5]: '54321'
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to