[Noam Raphael] > Many times I find myself asking for a slice of a specific length, rather > than a slice with a specific end. I suggest to add the syntax > object[start:>length] (or object[start:>length:jump]), beside the > existing syntax. It would be convenient at times, and I've got nothing against that. It isn't *necessary*, and if it were to be added the syntax should change. Python's sequence slicing is so similar to that in the earlier Icon language that for years I thought Guido borrowed it from Icon (but years later he told me that's not so). Icon has 1-based indexing (Python's is 0-based), but apart from that they're the same. In Icon, the notations are, e.g., S[5:8] # S[5], S[6], and S[7] and S[5+:3] # also S[5], S[6], and S[7] "+:" suggests addition in a way ":>" does not, so I think it's a better notation. Putting the '+' before the colon is also reminiscent of, e.g. i += j conceptually expanding to i = i+j Then i +: j conceptually expanding to i : i+j is the same syntactic pattern. I should note that Icon had the good sense to stop there too <wink>.
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