On 15 Jan 2006 21:14:33 -0800
"Dan Bishop" <[EMAIL PROTECTED]> wrote:
> although I personally would prefer
> 
>        (number)
>        /       \
> (realnumber)   complex
>   |   |   |
> int float |
>           |
>         Decimal

Mathematically, "real numbers" are a subset of "complex
numbers", though, so the set hierarchy would look like this:

"number"
  |
complex
  |
"real"
  |
"rational"
  |
  +-----,
  |     |
float  decimal
  |     |
  +-----'
  |     
 int

Noting of course that "real" and "number" are only 
abstract concepts -- they can't truly be represented
on the computer. AFAIK, there is no general purpose
"rational" type in Python, but there could be.

I'm bothered by the fact that "int" can be coerced into
either "decimal" or "float". In practice, you should
have to choose one or the other.  Practically speaking,
it probably makes more sense to do this:

"number"
  |
complex
  |
"real"
  |    
float
  |
decimal
  |     
 int

Because, in general, it is safer (no info loss) to
convert "int" to "decimal" where possible.

OTOH, for scientific or other performance-critical
applications, the exactitude of 'decimal' is less
desireable than the known precision and higher speed
of float implementations.

I suspect this is the sort of decision that was viewed
as "too tricky".

-- 
Terry Hancock ([EMAIL PROTECTED])
Anansi Spaceworks http://www.AnansiSpaceworks.com

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to