[SciPy-user] [SciPy-dev] default dtype
Alan G Isaac
aisaac at american.edu
Mon Jan 2 11:54:33 EST 2006
On Mon, 02 Jan 2006, Ed Schofield apparently wrote:
> Perhaps the most compelling argument against an integer
> default is the current behaviour with unsafe casting:
This is an important argument, but the most compelling
argument I believe is that the integer arrays are
- unlikely to be expected by the inexperienced (or those
with experience in say GAUSS or Matlab)
- less often wanted (or so I believe; is this wrong?)
- likely to be set explicitly in any case by those who
really want them
So the principle of least surprise suggests a float default,
and I believe the most common use case does as well.
Following on the problem of surprise, even if unsafe casting
is eliminated (and it may be viewed as a feature by some!),
new users will still be unpleasantly surprised. I.e.,
new users will be surprised even if there is an error
message instead of
>>> x=ones((2,2))
>>> print 3.14*x
[[ 3.14, 3.14,]
[ 3.14, 3.14,]]
>>> x[0,0]=x[0,0]*3.14
>>> print x
[[3,1,]
[1,1,]]
Cheers,
Alan Isaac
More information about the SciPy-User
mailing list