[PYTHON MATRIX-SIG] Type coercion two more times

James Hugunin jjh@Goldilocks.LCS.MIT.EDU
Fri, 26 Jan 96 11:35:47 EST


   From: hinsenk@ere.umontreal.ca (Hinsen Konrad)

      Ok, I'm starting to be convinced. My last hurdle to saying yes is
      having to explain the following to potential Python array users:
      >>> pi = omath.arctan(1.0)*4.0
      >>> m = Array_f([1.0,2.0,3.0])
      >>> m * pi
      Traceback (innermost last):
	File "<stdin>", line 1, in ?
      TypeError: inconsistant floating point types

   It could be made a bit easier by changing the text of the
   error message:
      TypeError: no automatic coercion between precisions

   Yet I agree, this is not a desirable feature. It is just the most
   acceptable among the evils we have to choose from.

An important thing to remember here is that a naive user should never
write m = array([1.0,2.0,3.0], 'f') (the new syntax).  They should
just write m = array([1.0,2.0,3.0]) which will produce an array of
doubles and should allow everybody to live happily ever after.

Not that I particularly like the type error either...

-Jim

=================
MATRIX-SIG  - SIG on Matrix Math for Python

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