[rust-dev] A la python array access

2013-11-20 Thread Gaetan
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]

Re: [rust-dev] A la python array access

2013-11-20 Thread Huon Wilson
On 20/11/13 21:03, Gaetan 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

Re: [rust-dev] A la python array access

2013-11-20 Thread Masklinn
On 2013-11-20, at 11:16 , Gaetan gae...@xeberon.net wrote: actually that was what I was expected, sorry I'm not very confortable with slices yet. It should not allocate, indeed, there is no reason. Python doesn’t allocate but the way it handle items, it doesn’t really behave like rust's

Re: [rust-dev] A la python array access

2013-11-20 Thread Gaetan
Hum that would prevent the step != 1 (allowed in python, but i never used it) Le 20 nov. 2013 11:59, Masklinn maskl...@masklinn.net a écrit : On 2013-11-20, at 11:16 , Gaetan gae...@xeberon.net wrote: actually that was what I was expected, sorry I'm not very confortable with slices yet. It