Re: list comprehension return a list and sum over in loop

2014-12-12 Thread KK Sasa
Sorry, i should say I'm using pythonxy, maybe it imports other things. -- https://mail.python.org/mailman/listinfo/python-list

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread KK Sasa
Peter Otten於 2014年12月12日星期五UTC+8下午8時32分55秒寫道: > Jussi Piitulainen wrote: > > > KK Sasa writes: > > > >> def p(x,t,point,z,obs): > >> d = x[0] > >> tau = [0]+[x[1:point]] > >> a = x[point:len(x)] > >> at = sum(i*j

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread KK Sasa
Jussi Piitulainen於 2014年12月12日星期五UTC+8下午7時12分39秒寫道: > KK Sasa writes: > > > def p(x,t,point,z,obs): > > d = x[0] > > tau = [0]+[x[1:point]] > > a = x[point:len(x)] > > at = sum(i*j for i, j in zip(a, t)) > > nu = [exp(z[k]

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread KK Sasa
Peter Otten於 2014年12月12日星期五UTC+8下午5時13分58秒寫道: > KK Sasa wrote: > > > Mark Lawrence於 2014年12月12日星期五UTC+8下午3時17分43秒寫道: > >> On 12/12/2014 06:22, KK Sasa wrote: > >> > Hi there, > >> > > >> > The list comprehension is results = [d2(t[

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread KK Sasa
Mark Lawrence於 2014年12月12日星期五UTC+8下午3時17分43秒寫道: > On 12/12/2014 06:22, KK Sasa wrote: > > Hi there, > > > > The list comprehension is results = [d2(t[k]) for k in xrange(1000)], where > > d2 is a function returning a list, say [x1,x2,x3,x4] for one example. So > &g

list comprehension return a list and sum over in loop

2014-12-11 Thread KK Sasa
Hi there, The list comprehension is results = [d2(t[k]) for k in xrange(1000)], where d2 is a function returning a list, say [x1,x2,x3,x4] for one example. So "results" is a list consisting of 1000 lists, each of length four. Here, what I want to get is the sum of 1000 lists, and then the resul