Re: Interesting list Validity (True/False)
- From: "Gabriel Genellina" <gagsl-py2@xxxxxxxxxxxx>
- Date: Tue, 15 May 2007 02:30:26 -0300
En Tue, 15 May 2007 01:37:07 -0300, mensanator@xxxxxxx <mensanator@xxxxxxx> escribió:
> <quote emphasis added>
> Sec 2.2.3:
> Objects of different types, *--->except<---* different numeric types
> and different string types, never compare equal;
> </quote>
The exceptions you mean are not exceptions to "'X==Y' means 'X equals
Y'".
I never said they were. I said they were exceptions to
"Obbjects of different types never compare equal".
This is an unfortunate wording, and perhaps should read: "For most builtin types, objects of different types never compare equal; such objects are ordered consistently but arbitrarily (so that sorting a heterogeneous sequence yields a consistent result). The exceptions being different numeric types and different string types, that have a special treatment; see section 5.9 in the Reference Manual for details."
And said section 5.9 should be updated too: "The objects need not have the same type. If both are numbers or strings, they are converted to a common type. Otherwise, objects of different builtin types always compare unequal, and are ordered consistently but arbitrarily. You can control comparison behavior of objects of non-builtin types by defining a __cmp__ method or rich comparison methods like __gt__, described in section 3.4."
I hope this helps a bit. Your performance issues don't have to do with the *definition* of equal or not equal, only with how someone decided to write the mpz class.
--
Gabriel Genellina
.
- Follow-Ups:
- Re: Interesting list Validity (True/False)
- From: mensanator@xxxxxxx
- Re: Interesting list Validity (True/False)
- References:
- Interesting list Validity (True/False)
- From: nufuhsus
- Re: Interesting list Validity (True/False)
- From: mensanator@xxxxxxx
- Re: Interesting list Validity (True/False)
- From: nufuhsus
- Re: Interesting list Validity (True/False)
- From: mensanator@xxxxxxx
- Re: Interesting list Validity (True/False)
- From: Carsten Haese
- Re: Interesting list Validity (True/False)
- From: mensanator@xxxxxxx
- Re: Interesting list Validity (True/False)
- From: Carsten Haese
- Re: Interesting list Validity (True/False)
- From: mensanator@xxxxxxx
- Re: Interesting list Validity (True/False)
- From: Steven D'Aprano
- Re: Interesting list Validity (True/False)
- From: mensanator@xxxxxxx
- Re: Interesting list Validity (True/False)
- From: Steven D'Aprano
- Re: Interesting list Validity (True/False)
- From: mensanator@xxxxxxx
- Re: Interesting list Validity (True/False)
- From: Carsten Haese
- Re: Interesting list Validity (True/False)
- From: mensanator@xxxxxxx
- Interesting list Validity (True/False)
- Prev by Date: Trying to choose between python and java
- Next by Date: Re: Generators in C code
- Previous by thread: Re: Interesting list Validity (True/False)
- Next by thread: Re: Interesting list Validity (True/False)
- Index(es):
Relevant Pages
|
|