[Python-Dev] [issue5029] Odd slicing behaviour (original) (raw)
Lambert, David W (S&T) LambertDW at Corning.com
Thu Jan 22 21:29:09 CET 2009
- Previous message: [Python-Dev] Unable to resolve svn.python.org: OS/X
- Next message: [Python-Dev] Should ftplib use UTF-8 instead of latin-1 encoding?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I cannot find that the documentation states "with negative step swap left with right". This is perhaps non-obvious. It is the words of the tutorial that caused issue 5029 author's confusion. 'a'[0::-1] != [] (is True, author expected False). The tutorial says:
"One way to remember how slices work is to think of the indices as pointing between characters, with the left edge of the first character numbered 0. Then the right edge of the last character of a string of n characters has index n, for example:"
- Previous message: [Python-Dev] Unable to resolve svn.python.org: OS/X
- Next message: [Python-Dev] Should ftplib use UTF-8 instead of latin-1 encoding?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]