Re: Sorting: too different times. Why?

2009-11-30 Thread Steven D'Aprano
On Sun, 22 Nov 2009 09:15:57 -0800, n00m wrote: Or take Drips by Eminem. What on earth do the drips mean? When you have a cold or flu, your nose drips. Some sexually transmitted diseases make your genitals drip. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting: too different times. Why?

2009-11-30 Thread n00m
Some sexually transmitted diseases make your genitals drip. I suspected this :-) Eminem is a famous misogynist -- http://mail.python.org/mailman/listinfo/python-list

Sorting: too different times. Why?

2009-11-22 Thread n00m
Any comment: class Vector: def __init__(self, x, y): self.x = x self.y = y def __cmp__(self, v): if self.x v.x and self.y v.y: return -1 return 0 def v_cmp(v1, v2): if v1.x v2.x and v1.y v2.y: return -1 return 0 from random

Re: Sorting: too different times. Why?

2009-11-22 Thread Ben Finney
n00m n...@narod.ru writes: Any comment: I get similar output. What were you expecting to happen? Did you have any questions? -- \“The right to search for truth implies also a duty; one must | `\ not conceal any part of what one has recognized to be true.” | _o__)

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
I was expecting the 1st method would be *slower* than the 2nd one :-) Or at least equal... Just random (intuitive) expectations -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting: too different times. Why?

2009-11-22 Thread Steven D'Aprano
In the subject line, you write too different times. You actually want two, the number, not too as in too many, too much. Lots of native English speakers get this wrong too :) On Sun, 22 Nov 2009 01:21:42 -0800, n00m wrote: Any comment: class Vector: def __init__(self, x, y):

Re: Sorting: too different times. Why?

2009-11-22 Thread Chris Rebert
On Sun, Nov 22, 2009 at 2:56 AM, n00m n...@narod.ru wrote: I was expecting the 1st method would be *slower* than the 2nd one :-) Or at least equal... Just random (intuitive) expectations The second method repeatedly looks up left_item.__class__.__cmp__ (i.e. Vector.__cmp__) when doing the

Re: Sorting: too different times. Why?

2009-11-22 Thread Diez B. Roggisch
n00m schrieb: Any comment: class Vector: def __init__(self, x, y): self.x = x self.y = y def __cmp__(self, v): if self.x v.x and self.y v.y: return -1 return 0 def v_cmp(v1, v2): if v1.x v2.x and v1.y v2.y: return -1

Re: Sorting: too different times. Why?

2009-11-22 Thread Duncan Booth
n00m n...@narod.ru wrote: Any comment: class Vector: def __init__(self, x, y): self.x = x self.y = y def __cmp__(self, v): if self.x v.x and self.y v.y: return -1 return 0 def v_cmp(v1, v2): if v1.x v2.x and v1.y v2.y:

Re: Sorting: too different times. Why?

2009-11-22 Thread Mark Dickinson
On Nov 22, 9:21 am, n00m n...@narod.ru wrote: Any comment: class Vector:     def __init__(self, x, y):         self.x = x         self.y = y     def __cmp__(self, v):         if self.x v.x and self.y v.y:             return -1         return 0 def v_cmp(v1, v2):     if v1.x v2.x

Re: Sorting: too different times. Why?

2009-11-22 Thread Dave Angel
n00m wrote: Any comment: snip def v_cmp(v1, v2): if v1.x v2.x and v1.y v2.y: return -1 return 0 The second part of the compound if is backwards. So if this is headed for production code, it better get fixed. DaveA --

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
Do you get the same magnitude difference if you make Vector a new-style class? Yes (I mean No): new-style's much faster And now it's elephants instead of vectors. Def: an elephant is smarter than another one IIF its size is strictly less but its IQ is strictly greater I.e. you can't compare

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
The second part of the compound if is backwards.  So if this is headed for production code, it better get fixed. DaveA Not sure I'm understanding your remark. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting: too different times. Why?

2009-11-22 Thread Duncan Booth
n00m n...@narod.ru wrote: And now it's elephants instead of vectors. Def: an elephant is smarter than another one IIF its size is strictly less but its IQ is strictly greater I.e. you can't compare (2, 8) to (20, 50) or let count them as equally smart elephants. and that still isn't a

Re: Sorting: too different times. Why?

2009-11-22 Thread MRAB
Steven D'Aprano wrote: In the subject line, you write too different times. You actually want two, the number, not too as in too many, too much. Lots of native English speakers get this wrong too :) [snip] It could mean that the times are not just different, they're _too_ different, ie a lot

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
Here meaningful order is: if elephant a[i] is smarter than elephant a[j] then i must be strictly less than j Of course, to the same effect we could sort them simply by sizes, but then time of sorting would increase by ~ 2 times -- due to decreasing of number of equally smart things. But here it

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
:-) Of course, by too I meant too, as in to much -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting: too different times. Why?

2009-11-22 Thread MRAB
n00m wrote: :-) Of course, by too I meant too, as in to much Although it's OK in English to say too much x or too many x, it's somewhat unnatural to say too different xs; it would have to be the xs are too different. Nobody said English was logical! :-) --

Re: Sorting: too different times. Why?

2009-11-22 Thread n00m
it's somewhat unnatural to say too different xs Aha. Thanks. PS For years I thought that song's title No Woman No Cry by Bob Marley means No Woman -- No Cry. As if a man got rid of his woman and stopped crying, out of her bad behaviour etc. It turned out to mean No, woman,.. no cry... Or take

Re: Sorting: too different times. Why?

2009-11-22 Thread Lie Ryan
n00m wrote: The second part of the compound if is backwards. So if this is headed for production code, it better get fixed. DaveA Not sure I'm understanding your remark. Maybe he meant, that this: if v1.x v2.x and v1.y v2.y should be: if v1.x v2.x and v1.y v2.y ? --

Re: Sorting: too different times. Why?

2009-11-22 Thread Dave Angel
n00m wrote: The second part of the compound if is backwards. So if this is headed for production code, it better get fixed. DaveA Not sure I'm understanding your remark. Well, others in the thread have observed the same thing, so maybe it doesn't matter. But the quoted code had

Re: Sorting: too different times. Why?

2009-11-22 Thread Mel
MRAB wrote: n00m wrote: :-) Of course, by too I meant too, as in to much Although it's OK in English to say too much x or too many x, it's somewhat unnatural to say too different xs; it would have to be the xs are too different. Nobody said English was logical! :-) Now that James

Re: Sorting: too different times. Why?

2009-11-22 Thread Steven D'Aprano
On Sun, 22 Nov 2009 15:08:28 +, Duncan Booth wrote: n00m n...@narod.ru wrote: And now it's elephants instead of vectors. Def: an elephant is smarter than another one IIF its size is strictly less but its IQ is strictly greater I.e. you can't compare (2, 8) to (20, 50) or let count