Nov. 1, 2013
1:26 p.m.
2013/11/1 Oscar Benjamin <oscar.j.benjamin@gmail.com>:
On 1 November 2013 10:17, Steven D'Aprano <steve@pearwood.info> wrote:
To break the ambiguity, we'd need a rule that End objects can only occur inside slices with at least one colon.
This would defeat much of the point of having a new notation. The problem with negative wraparound applies just as much to ordinary indexing as to slicing.
Not exactly as much. taking x[:-0] # intention: x[:len(x)] is a reasonable, which happens to fail in Python. While x[-0] # intention: x[len(x)] is an error in the first place, which happens not to raise an Exception in Python, but rather gives you a wrong result. Elazar