[Numpy-discussion] Args for rand and randn, and workarounds
oliphant.travis at ieee.org
Wed Jul 12 01:52:57 CDT 2006
Bill Baxter wrote:
> And mark my words, if we make rand() polymorphic,
> we will get just as many newbies coming to the list asking why
> ones(3, 4)
> doesn't work.
> I think you're probably right there, at least for Matlab converts.
> Matlab allows either way of calling for all of rand, ones, zeros, eye,
> and in general tries to make *every* function accept *any* possible
> combination of arguments that might make sense. So having rand()
> accept both, but not the others, will undoubtedly be unexpected to
> Matlab users. And the argument against funky overloading will be
> weaker since they'll be able to say "well rand() does it? why can't
> Fortunately it's pretty easy to define one's own custom versions of
> these little helper functions to make them just the way you like
> them. Or for rand(), just "from numpy.random import uniform_sample
> as rand" if that's the version you like.
Because of this. I've removed the global_namespace functions (fft,
ifft, rand, and randn) from numpy. They are *no longer* in the
top-level name-space. If you want them, setup a startup-file
More information about the Numpy-discussion