> The trouble is, there's no way to distinguish between > > l1[a:b:] > l1[slice(a,b)] > > I deliberately made the former be the same as l1[a:b:1] (and so have the > restriction on the length of slice) to reduce special-casing (both for > the user and me). Do you think I got that wrong? Yes I think you got that wrong. __getslice__ and __setlice__ are being deprecated (or at least discouraged), so you'll have objects implementing only __getitem__. Such objects will get a slice object passed to __getitem__ even for simple (one-colon) slices. If such an object wants to pass the slice on to a list object underlying the implementation, it should be allowed to. IOW slice(a, b, None) should be considered equivalent to L[a:b] in all situations. --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4