Re: min max from tuples in list

2013-12-16 Thread Gregory Ewing
Ned Batchelder wrote: On 12/16/13 10:49 AM, rusi wrote: And things that have consistency are of course... consistant (not consistent) In English, it's spelled consistent: http://en.wiktionary.org/wiki/consistant So to be consistent we should spell it performent? :-) -- Greg -- https://m

Re: min max from tuples in list

2013-12-16 Thread Ned Batchelder
On 12/16/13 10:49 AM, rusi wrote: On Sunday, December 15, 2013 9:11:15 AM UTC+5:30, Tim Roberts wrote: Dennis Lee Bieber wrote: Well "performant" is performant enough for the purposes of communicating on the python list I think :D Most probably could figure it out as being stylisticall

Re: min max from tuples in list

2013-12-16 Thread rusi
On Sunday, December 15, 2013 9:11:15 AM UTC+5:30, Tim Roberts wrote: > Dennis Lee Bieber wrote: > >>Well "performant" is performant enough for the purposes of communicating > >>on the python list I think :D > > Most probably could figure it out as being stylistically similar to > >conformant =>

Re: min max from tuples in list

2013-12-16 Thread Chris Angelico
On Sun, Dec 15, 2013 at 2:41 PM, Tim Roberts wrote: > Dennis Lee Bieber wrote: >> >>> >>>Well "performant" is performant enough for the purposes of communicating >>>on the python list I think :D >> >> Most probably could figure it out as being stylistically similar to >>"conformant", which

Re: min max from tuples in list

2013-12-14 Thread Tim Roberts
Dennis Lee Bieber wrote: > >> >>Well "performant" is performant enough for the purposes of communicating >>on the python list I think :D > > Most probably could figure it out as being stylistically similar to >"conformant", which I believe IS used in English > >conformant => something that

Re: min max from tuples in list

2013-12-13 Thread rusi
On Friday, December 13, 2013 11:58:51 AM UTC+5:30, Robert Voigtländer wrote: > >I've heard the term used often. It means something like, "performs > >well" or "runs fast". It may or may not be an English word, but that > >doesn't stop people from using it :-) > > If "google" can be used to me

Re: min max from tuples in list

2013-12-12 Thread Robert Voigtländer
>I've heard the term used often. It means something like, "performs >well" or "runs fast". It may or may not be an English word, but that >doesn't stop people from using it :-) > If "google" can be used to mean "make huge amouts of money with a > product that is inherently flawed" then I'll

Re: min max from tuples in list

2013-12-12 Thread Steven D'Aprano
On Thu, 12 Dec 2013 13:54:10 +0100, Peter Otten wrote: > Steven D'Aprano wrote: > >> In any case, sorting in Python is amazingly fast. You may be pleasantly >> surprised that a version that sorts your data, while nominally O(N log >> N), may be much faster than an O(N) solution that doesn't requi

Re: min max from tuples in list

2013-12-12 Thread Denis McMahon
On Wed, 11 Dec 2013 23:25:53 -0800, Robert Voigtländer wrote: > I have a list like this: > > a = [(52, 193), .. (36, 133)] # iterate over the list of tuples # creates a dictionary n0:[n1a, n1b, n1c ... ] # from tuples (n0,n1a), (n0,n1b), (n0,n1c) ... b = {} for x in a: if x[0] in b:

Re: min max from tuples in list

2013-12-12 Thread Steven D'Aprano
On Thu, 12 Dec 2013 12:36:51 +, MRAB wrote: > On 12/12/2013 11:44, Steven D'Aprano wrote: >> On Wed, 11 Dec 2013 23:25:53 -0800, Robert Voigtländer wrote: >> >>> Hi, >>> >>> I have a list like this: >>> >>> a = [(52, 193), (52, 193), (52, 192), ... >>> >>> >>> I need to find a -performant- way

Re: min max from tuples in list

2013-12-12 Thread Mark Lawrence
On 12/12/2013 15:02, Roy Smith wrote: In article <52a9a1a0$0$29992$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: I'm afraid I don't know what you mean by "performant". I've heard the term used often. It means something like, "performs well" or "runs fast". It may or may not

Re: min max from tuples in list

2013-12-12 Thread Roy Smith
In article <52a9a1a0$0$29992$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I'm afraid I don't know what you mean by "performant". I've heard the term used often. It means something like, "performs well" or "runs fast". It may or may not be an English word, but that doesn't s

Re: min max from tuples in list

2013-12-12 Thread Peter Otten
Steven D'Aprano wrote: > In any case, sorting in Python is amazingly fast. You may be pleasantly > surprised that a version that sorts your data, while nominally > O(N log N), may be much faster than an O(N) solution that doesn't require > sorted data. If I were a betting man, I'd be willing to wa

Re: min max from tuples in list

2013-12-12 Thread MRAB
On 12/12/2013 11:44, Steven D'Aprano wrote: On Wed, 11 Dec 2013 23:25:53 -0800, Robert Voigtländer wrote: Hi, I have a list like this: a = [(52, 193), (52, 193), (52, 192), ... I need to find a -performant- way to transform this into a list with tuples (a[0],[a[0][1]min],[a[0][1]max]). I'

Re: min max from tuples in list

2013-12-12 Thread Tim Chase
On 2013-12-12 11:44, Steven D'Aprano wrote: > In any case, sorting in Python is amazingly fast. You may be > pleasantly surprised that a version that sorts your data, while > nominally O(N log N), may be much faster than an O(N) solution that > doesn't require sorted data. If I were a betting man,

Re: min max from tuples in list

2013-12-12 Thread Steven D'Aprano
On Wed, 11 Dec 2013 23:25:53 -0800, Robert Voigtländer wrote: > Hi, > > I have a list like this: > > a = [(52, 193), (52, 193), (52, 192), ... > > > I need to find a -performant- way to transform this into a list with > tuples (a[0],[a[0][1]min],[a[0][1]max]). I'm afraid I don't know what you

Re: min max from tuples in list

2013-12-12 Thread Peter Otten
Peter Otten wrote: > Robert Voigtländer wrote: > >> Hi, >> >> I have a list like this: >> >> a = [(52, 193), (52, 193), (52, 192), (51, 193), (51, 191), (51, 190), >> (51, 189), (51, 188), (50, 194), (50, 187), (50, 186), (50, 185), (50, >> 184), (49, 194), (49, 183), (49, 182), (49, 181), (48,

Re: min max from tuples in list

2013-12-12 Thread Jussi Piitulainen
Robert Voigtländer writes: > Hi, > > I have a list like this: # shortened: a = [(52, 193), (52, 193), (52, 192), (51, 193), (51, 191), (51, 190), (51, 189), (51, 188), (50, 194)] > I need to find a -performant- way to transform this into a list with > tuples (a[0],[a[0][1]min],[a[0][1

Re: min max from tuples in list

2013-12-12 Thread Chris Angelico
On Thu, Dec 12, 2013 at 7:34 PM, Robert Voigtländer wrote: > Wow, thanks for the educating answer. I'll work through all the varaints. > And yes, I meant keep it unsorted. > > As I read it, sorting may be required then if I don't want to use the slowest > variant. I'll test them all. Sorting wou

Re: min max from tuples in list

2013-12-12 Thread Robert Voigtländer
Wow, thanks for the educating answer. I'll work through all the varaints. And yes, I meant keep it unsorted. As I read it, sorting may be required then if I don't want to use the slowest variant. I'll test them all. Thanks Robert -- https://mail.python.org/mailman/listinfo/python-list

Re: min max from tuples in list

2013-12-12 Thread Peter Otten
Robert Voigtländer wrote: > Hi, > > I have a list like this: > > a = [(52, 193), (52, 193), (52, 192), (51, 193), (51, 191), (51, 190), > (51, 189), (51, 188), (50, 194), (50, 187), (50, 186), (50, 185), (50, > 184), (49, 194), (49, 183), (49, 182), (49, 181), (48, 194), (48, 180), > (48, 179),

Re: min max from tuples in list

2013-12-12 Thread Chris Angelico
On Thu, Dec 12, 2013 at 6:25 PM, Robert Voigtländer wrote: > I need to find a -performant- way to transform this into a list with tuples > (a[0],[a[0][1]min],[a[0][1]max]). > > Hard to explaint what I mean .. [0] of the first three tuples is 52. [1] is > 193,193 and 192. > What I need as result

min max from tuples in list

2013-12-11 Thread Robert Voigtländer
Hi, I have a list like this: a = [(52, 193), (52, 193), (52, 192), (51, 193), (51, 191), (51, 190), (51, 189), (51, 188), (50, 194), (50, 187), (50, 186), (50, 185), (50, 184), (49, 194), (49, 183), (49, 182), (49, 181), (48, 194), (48, 180), (48, 179), (48, 178), (48, 177), (47, 194), (47, 17