[SciPy-user] changing the default data type of zeros and ones

Ryan Krauss ryanlists at gmail.com
Thu Oct 11 11:34:54 EDT 2007


Sorry, this is a pylab/numpy incompatibility problem.  In order to not
spend a lot of time talking about namespaces and such, I teach them to
put

from scipy import *
from pylab import *

at the beginning of every script and from there it will kind of feel
like Matlab.  It is pylab.zeros and pylab.ones that is the problem.

How do I best explain this to my students?

Ryan

On 10/11/07, Alan G Isaac <aisaac at american.edu> wrote:
> On Thu, 11 Oct 2007, Ryan Krauss apparently wrote:
> > I understand the computer science arguments for zeros and
> > ones returning integers by default, but is this something
> > we are willing to consider changing?
>
> It was changed some time ago.
>
> Cheers,
> Alan Isaac
>
> >>> import numpy
> >>> numpy.__version__
> '1.0.3.1'
> >>> numpy.zeros(10)
> array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])
> >>> numpy.zeros(10).dtype
> dtype('float64')
> >>>
>
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list