Typo, I meant to type: Python 3.5 a[i*len(a)//n:(i+1)*len(a)//n]
Julia: a[1+i*end÷n:(i+1)end÷n] I'm just learning Python, and must say I find indexing in Python to be very awkward compared to Julia or Matlab. Do you have any suggestion for how I should do this in Python? a[[1; 4; 7:2:15]] So far I've got: a[np.concatenate(([1,4], np.arange(7,17,2)))] On Tuesday, April 5, 2016 at 8:46:57 AM UTC+2, DNF wrote: > > > On Saturday, April 2, 2016 at 1:55:55 PM UTC+2, Spiritus Pap wrote: >> >> A simple example why it makes my *life hard*: Assume there is an array >> of size 100, and i want to take the i_th portion of it out of n. This is a >> common scenario for research-code, at least for me and my friends. >> In python: >> a[i*100/n:(i+1)*100/n] >> In julia: >> a[1+div(i*100,n):div((i+1)*100,n)] >> >> A lot more cumbersome in julia, and it is annoying and unattractive. This >> is just a simple example. >> > > Python 3.5 > a[i*len(a)//n:(i+1)*len(a)//n] > > Julia: > a[1+i*end÷5:(i+1)end÷5] > >