[PYTHON MATRIX-SIG] naming conventions

Jim Hugunin hugunin@mit.edu
Wed, 14 Aug 1996 13:00:58 -0400

Michael McLay wrote:
> Jim Hugunin writes:
>  > Also, I've decided to change the names of the precision functions
>  > (previously Float, Integer, and Complex)
>  >
>  > complexcode(32)
>  > floatcode(32)
>  > intcode(16)
> Thank you for making this change.  The inclusion of the actual size
> will make it clear that the same size numbers will be used on all
> machines and it eliminates the need to remember the size names that
> are abstract.  I am curious why the new notation looks like a function
> call.  There should be a fairly short list of names needed.  Could it
> be done  as a constant like complexcode32 complexcode64?  That would
> be easier to type.  Also, isn't the code workd redundant?  How about
> shortening the names to something like:
> Float  -> float32
> double -> float64
> Integer -> int32
> Long ->    int64

Okay, I like your names better than mine, though in this case I would
use capital letters.


This is consistent with the naming conventions for constants in python
as in Ellipses and None, (and in NumPy as in NewAxis).

My problem now is an easy way to specify that I want an array of floats
that are the same size as python floats.  I don't believe there is any
guarantee that this is the same as Float64 on all systems.

I used floatcode() as a way to specfify that in my system.

types.FloatType is an option, but a little bit cumbersome for my
tastes.  And I'd probably import that as well as IntType and ComplexType
into the Numeric namespace.  Other suggestions?  I could probably
support using float (the builtin function to convert to a python float)
as the parameter but that would be a definate kludge.


MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org