[PYTHON MATRIX-SIG] Re: A fix for mrange

James Hugunin jjh@Goldilocks.LCS.MIT.EDU
Tue, 30 Jan 96 11:12:04 EST


  Shouldn't mrange honor the typecode?

Obviously, I'll switch over to using your new version.  However, I
think that it's important to make a small change for determining the
default typecode.  If any of the arguments is a python float, than the
range returned should be an array of doubles, not longs.

ie. arange(1, 5, 1.0) should be array([1.,2.,3.,4.], 'd')

I'll add some checks to the code to get this behavior in the case of
no explicit typecode given.

BTW - the typecode argument is really intended to be used as a keyword
argument, as in arange(1, 5, 1.0, typecode=Integer()).  This keeps
things uniform for the case of arange(10, typecode=Integer()) which
wouldn't work without the keyword argument.

  The last is a little weird, but mrange always honors the typecode, 
  which I think is very important. When I specify a type, I expect an
  array of that type.

Agreed!

  To coerce or not to coerce, that is the question...

Now that question needs to be addressed seperately.

Thanks for the fix - Jim

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

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