[Python-Dev] Re: Decimal data type issues (original) (raw)

Paul Moore pf_moore at yahoo.co.uk
Tue Apr 13 16:34:51 EDT 2004


"Batista, Facundo" <FBatista at uniFON.com.ar> writes:

[...]

Actually, imposing the limit means more code and complexity, and I don't find any benefit. But as I answered to Paul, I'm searching for community agreement before changing functionality that I found in the implementation

[...]

So, while Decimal(25) == 25 is True, hash(Decimal(25)) should be equal to hash(25).

The detail is that you can NOT compare Decimal to floats or strings, so maybe we should not worry about them to give the same hashes. I'm OK to make hash(int or long) == hash(Decimal(int or long)). But only to int or long, not float nor string. Do you agree?

So far, I've found your instincts to be pretty good. I'd say

  1. Remove the limits.
  2. Make hashes the same for int/long, but not str/float.
  3. While I'm at it, I'm OK with the names you suggest for the 3 extra functions.

Paul.

This signature intentionally left blank



More information about the Python-Dev mailing list