Re: [Tutor] Flatten a list in tuples and remove doubles

2012-07-29 Thread eryksun
On Sun, Jul 29, 2012 at 4:29 PM, Peter Otten <__pete...@web.de> wrote: > > If you have to sort your data anyway you can sort it first and then apply > itertools.groupby()... That was my thinking. I wrote it with groupby (see link below) because Francesco described field 0 as "in growing order". h

Re: [Tutor] Flatten a list in tuples and remove doubles

2012-07-29 Thread Francesco Loffredo
Il 29/07/2012 03:42, Dave Angel wrote: On 07/28/2012 07:12 PM, Francesco Loffredo wrote: You might find it enlightening to look up: http://www.doughellmann.com/PyMOTW/ which explores the Pythons standard library. Site promptly visited, PDF downloaded, started reading. It really seems a

Re: [Tutor] Flatten a list in tuples and remove doubles

2012-07-29 Thread Peter Otten
eryksun wrote: > On Sun, Jul 29, 2012 at 7:21 AM, Peter Otten <__pete...@web.de> wrote: >> >> If you don't have to deal with large datasets many of its functions can >> easily be emulated with lists and loops though. As an example here's the >> grouping with a plain vanilla dict: >> >> groups = {}

Re: [Tutor] Flatten a list in tuples and remove doubles

2012-07-29 Thread eryksun
On Sun, Jul 29, 2012 at 7:21 AM, Peter Otten <__pete...@web.de> wrote: > > If you don't have to deal with large datasets many of its functions can > easily be emulated with lists and loops though. As an example here's the > grouping with a plain vanilla dict: > > groups = {} > for item in data: >

Re: [Tutor] Flatten a list in tuples and remove doubles

2012-07-29 Thread Mark Lawrence
On 29/07/2012 18:32, Alan Gauld wrote: On 29/07/12 15:21, Mark Lawrence wrote: Reminds me of the Welsh selectors, two were wise and chose Dai, but three were foolish and chose Gareth. That should lead to some head scratching!!! I'm scratching, but it sounds like a throwback to the 1980's nat

Re: [Tutor] Flatten a list in tuples and remove doubles

2012-07-29 Thread Alan Gauld
On 29/07/12 15:21, Mark Lawrence wrote: Reminds me of the Welsh selectors, two were wise and chose Dai, but three were foolish and chose Gareth. That should lead to some head scratching!!! I'm scratching, but it sounds like a throwback to the 1980's national rugby team... Dai Jones and Gareth

Re: [Tutor] Flatten a list in tuples and remove doubles

2012-07-29 Thread Mark Lawrence
On 29/07/2012 14:16, Alan Gauld wrote: On 29/07/12 12:21, Peter Otten wrote: plenty modules I haven't explored yet - and I must admit itertools is one that I really should get to grips with... You're nuts :) Itertools to me is the Swiss Army Knife If you don't have to deal with large data

Re: [Tutor] Flatten a list in tuples and remove doubles

2012-07-29 Thread Alan Gauld
On 29/07/12 12:21, Peter Otten wrote: plenty modules I haven't explored yet - and I must admit itertools is one that I really should get to grips with... You're nuts :) Itertools to me is the Swiss Army Knife If you don't have to deal with large datasets many of its functions can easily be

Re: [Tutor] Flatten a list in tuples and remove doubles

2012-07-29 Thread Peter Otten
Mark Lawrence wrote: > On 29/07/2012 00:53, Alan Gauld wrote: >> On 29/07/12 00:12, Francesco Loffredo wrote: >> >>> Every time this happens, I have to admit that I'm a newbie and I've >>> still got a lot to learn about Python. Especially about its wonderful >>> standard library. >> >> Don't worry

Re: [Tutor] Flatten a list in tuples and remove doubles

2012-07-29 Thread Mark Lawrence
On 29/07/2012 00:53, Alan Gauld wrote: On 29/07/12 00:12, Francesco Loffredo wrote: Every time this happens, I have to admit that I'm a newbie and I've still got a lot to learn about Python. Especially about its wonderful standard library. Don't worry, I've been using Python for 15 years and