Re: Reading 3 objects at a time from list

2009-04-11 Thread Vito De Tullio
Matteo wrote: > it works and I like slices, but I was wondering if there was another > way of doing the same thing, maybe reading the numbers in groups of > arbitrary length n... from http://docs.python.org/library/itertools.html#recipes def grouper(n, iterable, fillvalue=None): "grouper(3,

Re: Reading 3 objects at a time from list

2009-04-11 Thread Aahz
In article <49e06774$0$700$5fc3...@news.tiscali.it>, Francesco Bochicchio wrote: >> On Sat, Apr 11, 2009 at 1:44 AM, Matteo wrote: >>> >>> I need to pass the numbers to a function, but three at a time, until >>> the string ends. The strings are of variable length, but always a >>> multiple of th

Re: Reading 3 objects at a time from list

2009-04-11 Thread Peter Otten
Matteo wrote: > Hi all, > let's see if there is a more "pythonic" way of doing what I'm trying > to do. > I have a lot of strings with numbers like this one: > > string = "-1 1.3 100.136 1 2.6 100.726 1 3.9 101.464 -1 5.2 102.105" > > I need to pass the numbers to a function, but three at a time

Re: Reading 3 objects at a time from list

2009-04-11 Thread Francesco Bochicchio
Chris Rebert ha scritto: On Sat, Apr 11, 2009 at 1:44 AM, Matteo wrote: Hi all, let's see if there is a more "pythonic" way of doing what I'm trying to do. I have a lot of strings with numbers like this one: string = "-1 1.3 100.136 1 2.6 100.726 1 3.9 101.464 -1 5.2 102.105" I need to pass t

Re: Reading 3 objects at a time from list

2009-04-11 Thread Chris Rebert
On Sat, Apr 11, 2009 at 1:44 AM, Matteo wrote: > Hi all, > let's see if there is a more "pythonic" way of doing what I'm trying > to do. > I have a lot of strings with numbers like this one: > > string = "-1 1.3 100.136 1 2.6 100.726 1 3.9 101.464 -1 5.2 102.105" > > I need to pass the numbers to

Reading 3 objects at a time from list

2009-04-11 Thread Matteo
Hi all, let's see if there is a more "pythonic" way of doing what I'm trying to do. I have a lot of strings with numbers like this one: string = "-1 1.3 100.136 1 2.6 100.726 1 3.9 101.464 -1 5.2 102.105" I need to pass the numbers to a function, but three at a time, until the string ends. The st