vyper
vyper copied to clipboard
VIP: support pythonic slicing
Simple Summary
Allow xs[start:end]
instead of slice(xs, start, len)
Motivation
It's more pythonic, less friction for new users.
Backwards Compatibility
We might want to deprecate slice.
Copyright
Copyright and related rights waived via CC0
- would
xs[start:end:step]
also work? - What are the restrictions on
start
,end
andstep
in terms of their value? (constants, immutables, vars, etc.)
I think we should disallow step
for now
the start
and end
args could have basically the same restrictions as slice
, but maybe also allow negative end (so xs[start:-1]
would be equivalent to slice(xs, start, len(xs) - start - 1)
👋 . Good first issue.