What's the difference between these 2 statements?

2005-04-20 Thread ATSkyWalker
What's the difference between these 2 statements?

If you have a String s="12345"

s[len(s)::-1] = "54321"

But

s[len(s):0:-1] = "5432"

Why? What's the difference? What number then can I use as the end of
the slice if I were to supply all 3 parameters?


Thanks,
AT
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the difference between these 2 statements?

2005-04-20 Thread ATSkyWalker
Peter,

I like the way you put it "the gap between the last and
the last but one character" :-).

I guess this is a side effect of of python's asymetric slice indexing
approach which takes a little getting used to.

AT

-- 
http://mail.python.org/mailman/listinfo/python-list