Re: min max from tuples in list

2013-12-16 Thread Chris Angelico
On Sun, Dec 15, 2013 at 2:41 PM, Tim Roberts t...@probo.com wrote: Dennis Lee Bieber wlfr...@ix.netcom.com 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

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 = something

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 stylistically

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 --

Re: min max from tuples in list

2013-12-14 Thread Tim Roberts
Dennis Lee Bieber wlfr...@ix.netcom.com 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 G conformant = something

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 mean make huge

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 r.voigtlaen...@gmail.com 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.

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), (48,

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 Chris Angelico
On Thu, Dec 12, 2013 at 7:34 PM, Robert Voigtländer r.voigtlaen...@gmail.com 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

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

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, 194), (48,

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 mean by

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, I'd

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]).

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 wager

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 steve+comp.lang.pyt...@pearwood.info 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

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 steve+comp.lang.pyt...@pearwood.info 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

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 to transform this into a

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 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 require

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 happily

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,