Op 2005-10-28, Ron Adam schreef <[EMAIL PROTECTED]>:
>
> I haven't heard he was removing __cmp__,
I read somewhere he was considering it.
> but I would think the sort or
> sorted functions would just use the available comparisons methods or
> equivalent C code for base types. So I expect it wo
Antoon Pardon wrote:
> If you are concerned about sorting times, I think you should
> be more concerned about Guido's idea of doing away with __cmp__.
> Sure __lt__ is faster. But in a number of cases writing __cmp__
> is of the same complexity as writing __lt__. So if you then
> need a __lt__, __l
Antoon Pardon wrote:
> Op 2005-10-26, Ron Adam schreef <[EMAIL PROTECTED]>:
>
>>Adding complexity to cmp may not break code, but it could probably slow
>>down sorting in general. So I would think what ever improvements or
>>alternatives needs to be careful not to slow down existing sorting ca
Op 2005-10-28, Antoon Pardon schreef <[EMAIL PROTECTED]>:
> Op 2005-10-26, Ron Adam schreef <[EMAIL PROTECTED]>:
>>
>
> These are the results.
>
>: 1000 repeats, 1000 long, 10.061425 secs
>: 1000 repeats, 1000 long, 9.544035 secs
>: 1000 repeats, 1000 long, 10.450864 secs
>: 1000 repeats, 1000 lon
Op 2005-10-26, Ron Adam schreef <[EMAIL PROTECTED]>:
>
> Adding complexity to cmp may not break code, but it could probably slow
> down sorting in general. So I would think what ever improvements or
> alternatives needs to be careful not to slow down existing sorting cases.
As a result of Bengt
On 27 Oct 2005 08:12:15 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote:
[...]
>
>The evidence suggests that cmp is not used in sorting. If you have a
>list of sets, sort will happily try to sort it, while calling cmp
>with a set as an argument throws an exception.
>
A data point re evidence:
>>> cl
Op 2005-10-26, Christopher Subich schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> Op 2005-10-25, Christopher Subich schreef <[EMAIL PROTECTED]>:
>>>
>>>My biggest complaint here is about returning None or IncomparableValue;
>>>if that happens, then all code that relies on cmp returning a nu
Op 2005-10-26, Ron Adam schreef <[EMAIL PROTECTED]>:
>
>
> Antoon Pardon wrote:
>
>> Op 2005-10-25, Steven D'Aprano schreef <[EMAIL PROTECTED]>:
>
>>>Can somebody remind me, what is the problem Antoon is trying to solve here?
>>
>>
>> Well there are two issues. One about correct behaviour and one
Antoon Pardon wrote:
> Christopher Subich schreef :
>
>> Antoon Pardon wrote:
>>> >>>from decimal import Decimal
>>> >>>Zero = Decimal(0)
>>> >>>cmp( ( ) , Zero)
>>> -1
>>> >>>cmp(Zero, 1)
>>> -1
>>> >>>cmp(1, ( ) )
>>> -1
>>
>> I'd argue that the wart here is that cmp doesn't throw an exception,
Antoon Pardon wrote:
> Op 2005-10-25, Christopher Subich schreef <[EMAIL PROTECTED]>:
>>
>>My biggest complaint here is about returning None or IncomparableValue;
>>if that happens, then all code that relies on cmp returning a numeric
>>result will have to be rewritten.
>
>
> I don't know. Ther
Antoon Pardon wrote:
> Op 2005-10-25, Steven D'Aprano schreef <[EMAIL PROTECTED]>:
>>Can somebody remind me, what is the problem Antoon is trying to solve here?
>
>
> Well there are two issues. One about correct behaviour and one about
> practicallity.
>
> The first problem is cmp. This is w
Op 2005-10-25, Steven D'Aprano schreef <[EMAIL PROTECTED]>:
> On Tue, 25 Oct 2005 10:09:29 -0400, Christopher Subich wrote:
>
By analogy, one can ask, "is the cat inside the box?" and get the answer
"No", but this does not imply that therefore the box must be inside the
cat.
>>>
>>>
>
Op 2005-10-25, Christopher Subich schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>
>> I also think there is the problem that people aren't used to partial
>> ordering. There is an ordering over sets, it is just not a total
>> ordering. But that some pairs are uncomparable (meaning that neither
Op 2005-10-25, Christopher Subich schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> Op 2005-10-25, Christopher Subich schreef <[EMAIL PROTECTED]>:
>>
>
>>>Which is exactly why a < b on sets returns True xor False, but cmp(a,b)
>>>throws an exception.
>>
>>
>> I don't see the conection.
>>
Steven D'Aprano wrote:
> On Tue, 25 Oct 2005 10:09:29 -0400, Christopher Subich wrote:
>
>
By analogy, one can ask, "is the cat inside the box?" and get the answer
"No", but this does not imply that therefore the box must be inside the
cat.
>>>
>>>
>>>Bad analogy, this doesn't define
Antoon Pardon wrote:
> Op 2005-10-25, Christopher Subich schreef <[EMAIL PROTECTED]>:
>
>>Which is exactly why a < b on sets returns True xor False, but cmp(a,b)
>>throws an exception.
>
>
> I don't see the conection.
>
> The documentation states that cmp(a,b) will return a negative value if
On Tue, 25 Oct 2005 10:09:29 -0400, Christopher Subich wrote:
>>>By analogy, one can ask, "is the cat inside the box?" and get the answer
>>>"No", but this does not imply that therefore the box must be inside the
>>>cat.
>>
>>
>> Bad analogy, this doesn't define a mathematical ordering, the subs
Op 2005-10-25, Christopher Subich schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> It *is* a definition of an ordering.
>>
>> For something to be an ordering it has to be anti symmetric and transitive.
>>
>> The subset relationships on sets conform to these conditions so it is a
>> (partia
Antoon Pardon wrote:
> I also think there is the problem that people aren't used to partial
> ordering. There is an ordering over sets, it is just not a total
> ordering. But that some pairs are uncomparable (meaning that neither
> one is smaller or greater) doesn't imply that comparing them is
>
Antoon Pardon wrote:
> It *is* a definition of an ordering.
>
> For something to be an ordering it has to be anti symmetric and transitive.
>
> The subset relationships on sets conform to these conditions so it is a
> (partial)
> ordering. Check your mathematic books, Why you would think this is
James Stroud wrote:
> On Monday 24 October 2005 04:33, Steve Holden wrote:
>
>>Well in that case it's time to declare Principia Mathematica obsolete.
>>The real numbers are a two-dimensional field, and you are proposing to
>>define an ordering for it.
>
>
> I wasn't a math major, but don't you m
On Monday 24 October 2005 04:33, Steve Holden wrote:
> Well in that case it's time to declare Principia Mathematica obsolete.
> The real numbers are a two-dimensional field, and you are proposing to
> define an ordering for it.
I wasn't a math major, but don't you mean "the complex numbers are a t
Op 2005-10-24, Steven D'Aprano schreef <[EMAIL PROTECTED]>:
> On Mon, 24 Oct 2005 09:23:58 +, Antoon Pardon wrote:
>
>> Op 2005-10-21, Christopher Subich schreef <[EMAIL PROTECTED]>:
>>> Antoon Pardon wrote:
It would be better if cmp would give an indication it
can't compare two objec
On Mon, 24 Oct 2005 09:23:58 +, Antoon Pardon wrote:
> Op 2005-10-21, Christopher Subich schreef <[EMAIL PROTECTED]>:
>> Antoon Pardon wrote:
>>> It would be better if cmp would give an indication it
>>> can't compare two objects instead of giving incorrect
>>> and inconsistent results.
>>
>>
Op 2005-10-24, Steve Holden schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>>
>set([1]) <= set([2])
>>
>> False
>>
>set([2]) <= set([1])
>>
>> False
>>
> Set orderingd are explicitly documented as being based on proper
> subsetting. This is an abuse of the operators to make subs
Antoon Pardon wrote:
> Op 2005-10-21, Christopher Subich schreef <[EMAIL PROTECTED]>:
>
>>Antoon Pardon wrote:
>>
>>>It would be better if cmp would give an indication it
>>>can't compare two objects instead of giving incorrect
>>>and inconsistent results.
>>
>>If two objects aren't totally compar
Op 2005-10-21, Christopher Subich schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> It would be better if cmp would give an indication it
>> can't compare two objects instead of giving incorrect
>> and inconsistent results.
>
> If two objects aren't totally comparable, then using 'cmp' on them
Antoon Pardon wrote:
> It would be better if cmp would give an indication it
> can't compare two objects instead of giving incorrect
> and inconsistent results.
If two objects aren't totally comparable, then using 'cmp' on them is
ill-defined to begin with. The Standard Thing To Do is throw an
Op 2005-10-20, Steve Holden schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>>
> Ergo: use rich comparisons.
rich comparosons can only solve the problem partly.
Python does have the cmp function and that can give
totaly inconsistent results even when the order
defined by the rich comparison
[Toby Dickenson]
> ...
> ZODB's BTrees work in a similar way but use the regular python comparison
> function, and the lack of a guarantee of a total ordering can be a liability.
> Described here in 2002, but I think same is true today:
> http://mail.zope.org/pipermail/zodb-dev/2002-February/002304
Antoon Pardon wrote:
> Op 2005-10-20, Steve Holden schreef <[EMAIL PROTECTED]>:
>
>>Antoon Pardon wrote:
>>
>>>I was wondering how people would feel if the cmp function and
>>>the __cmp__ method would be a bit more generalised.
>>>
>>>The problem now is that the cmp protocol has no way to
>>>indic
On Thursday 20 October 2005 11:53, Steve Holden wrote:
> Personally I'm still not convinced that your requirement reflects a
> substantial use case (but then I'm getting used to that ;-). Just
> because an ordering is partial that doesn't mean that two instances of a
> class shouldn't be compar
Op 2005-10-20, Steve Holden schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> I was wondering how people would feel if the cmp function and
>> the __cmp__ method would be a bit more generalised.
>>
>> The problem now is that the cmp protocol has no way to
>> indicate two objects are incompara
Antoon Pardon wrote:
> I was wondering how people would feel if the cmp function and
> the __cmp__ method would be a bit more generalised.
>
> The problem now is that the cmp protocol has no way to
> indicate two objects are incomparable, they are not
> equal but neither is one less or greater tha
Op 2005-10-20, Mikael Olofsson schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> Op 2005-10-20, Duncan Booth schreef <[EMAIL PROTECTED]>:
>>
>>>Antoon Pardon wrote:
>>>
>>>
The problem now is that the cmp protocol has no way to
indicate two objects are incomparable, they are not
e
Antoon Pardon wrote:
> Op 2005-10-20, Duncan Booth schreef <[EMAIL PROTECTED]>:
>
>>Antoon Pardon wrote:
>>
>>
>>>The problem now is that the cmp protocol has no way to
>>>indicate two objects are incomparable, they are not
>>>equal but neither is one less or greater than the other.
>>
>>If that i
Antoon Pardon wrote:
> Op 2005-10-20, Duncan Booth schreef <[EMAIL PROTECTED]>:
>> Antoon Pardon wrote:
>>
>>> The problem now is that the cmp protocol has no way to
>>> indicate two objects are incomparable, they are not
>>> equal but neither is one less or greater than the other.
>>
>> If that i
Op 2005-10-20, Duncan Booth schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>
>> The problem now is that the cmp protocol has no way to
>> indicate two objects are incomparable, they are not
>> equal but neither is one less or greater than the other.
>
> If that is the case then you implement _
Antoon Pardon wrote:
> The problem now is that the cmp protocol has no way to
> indicate two objects are incomparable, they are not
> equal but neither is one less or greater than the other.
If that is the case then you implement __eq__ and __ne__ to return
True/False and make cmp throw an excep
I was wondering how people would feel if the cmp function and
the __cmp__ method would be a bit more generalised.
The problem now is that the cmp protocol has no way to
indicate two objects are incomparable, they are not
equal but neither is one less or greater than the other.
So I thought that e
40 matches
Mail list logo