[Numpy-discussion] Re: API inconsistencies

Stefan van der Walt stefan at sun.ac.za
Thu May 4 14:57:19 EDT 2006


On Thu, May 04, 2006 at 04:08:04PM -0500, Robert Kern wrote:
> Albert Strasheim wrote:
> > Hello all
> > 
> > I noticed some inconsistencies in the NumPy API that might warrant some
> > attention. On the one hand we have functions like the following:
> > 
> > empty((d1,...,dn),dtype=int,order='C')
> > empty((d1,...,dn),dtype=int,order='C')
> > ones(shape, dtype=int_) (no order?)
> > 
> > whereas the functions for generating random matrices look like this:
> > 
> > rand(d0, d1, ..., dn)
> > randn(d0, d1, ..., dn)
> > 
> > Was this done for a specific reason? Numeric compatibility perhaps?
> 
> Mostly. rand() and randn() are convenience functions anyways, so they present an
> API that is convenient for their particular task.
> 
> > Is this
> > something that should be changed?
> 
> Not unless if you want to be responsible for breaking substantial
amounts of code.

Why can't we modify the code to accept a new calling convention, in
addition to the older one?

Maybe try to run standard_normal(args), but if it throws a TypeError
call standard_normal(*args).

Regards
Stéfan




More information about the NumPy-Discussion mailing list