[Numpy-discussion] [Python-3000] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)
Thu Apr 26 12:26:02 CDT 2007
On Thu, 26 Apr 2007 10:11:27 PDT, Bill Janssen <email@example.com> wrote:
>> Are the base number operations in Python all that difficult to
>Well, they're a little tricky.
>But the basic problem with "number" support, in almost every
>programming language, is that they are too low-level an abstraction.
>A number in a program is never *just* an integer or a float. It's
>always an integer or float (or complex, OK) deployed in support of a
>very specific purpose. It's a loop index, or a weight in kilos, or
>the number of calendar entries for a particular day. It often has
>units, and a fixed range of values or fixed set of values, neither of
>which are taken into account in most programming languages.
>Strings really suffer from the same lack of focus. A string is never
>just a string. It's a book title, or a filename, or a person's
>surname, or an email address. It's usually got a particular human
>language (or computer OS) associated with it. Each of these usages
>has particular limitations and patterns which limit both its range of
>values, and the operations which can be successfully applied to it.
I definitely agree with this, and resolving it would probably address
a large class of mistakes made when doing any programming involving
numbers and strings (anyone done much of that lately? :).
Does the introduction of a lot of base classes for `int' and `float'
do anything to address this, though? What you really want is a bunch
of new subclasses of them, the opposite.
More information about the Numpy-discussion