On Wed, Nov 20, 2013 at 5:03 AM, Gaetan <[email protected]> wrote:
> Hello
>
> I'd like to know if you think it could be feasible to have a Python-like
> syntax for indices in array and vector?
>
> I find it so obvious and practical.
>
> let i = ~[1, 2, 3, 4, 5]
>
> i[1] returns a the second item ("2")
> i[1:] returns ~[2, 3, 4, 5]
> i[:-2] return ~[1, 2, 3, 4]
> i[-2] returns ~[4, 5]
> i[1,-1] returns ~[2, 3, 4]
>
> Thanks !
>
> -----
> Gaetan

Slicing sugar could be implemented but it definitely wouldn't allocate
new dynamic arrays.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to