[sage-support] Re: function output to list

2011-03-26 Thread clodemil
Alastair, Everything sorted. Many thanks. Claude. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support UR

Re: [sage-support] Re: function output to list

2011-03-26 Thread Alastair Irving
On 26/03/2011 08:52, clodemil wrote: Alastair, Thanks a lot. the Pytonic way: def Ppulse(mesures): return [N((l[0]-l[1]),12) for l in mesures] works(I shall need to understand/study why!!) Its a list comprehension. The other solution: def Ppulse(mesures): result=[] for k,l in

[sage-support] Re: function output to list

2011-03-26 Thread clodemil
Alastair, Thanks a lot. the Pytonic way: def Ppulse(mesures): return [N((l[0]-l[1]),12) for l in mesures] works(I shall need to understand/study why!!) The other solution: def Ppulse(mesures): result=[] for k,l in enumerate(mesures) result.append(N((l[0]-l[1]),12)) gives a