[SciPy-Dev] better signature for stats.linregress
Ralf Gommers
ralf.gommers@googlemail....
Fri Jul 16 23:30:45 CDT 2010
On Fri, Jul 16, 2010 at 12:37 AM, <josef.pktd@gmail.com> wrote:
> On Thu, Jul 15, 2010 at 11:34 AM, Ralf Gommers
> <ralf.gommers@googlemail.com> wrote:
> > The current linregress signature is (*args) which is not very
> informative,
> > as pointed out in http://projects.scipy.org/scipy/ticket/1164. I propose
> to
> > change it to (x, y=None), which doesn't break any code. Changes and tests
> > are here: http://github.com/rgommers/scipy/commits/linregress-signature.
> >
> > Does this look OK?
>
> looks good to me
>
>
>
> 2381 + if x.shape[0] == 2:
> 2382 + y = x[1, :]
> 2383 + x = x[0, :]
> 2384 + elif x.shape[1] == 2:
> 2385 + y = x[:, 1]
> 2386 + x = x[:, 0]
>
> could use tuple unpacking instead, works with arrays
> x,y = x
> and
> x,y = x.T
>
> That's a bit cleaner indeed. Committed in r6612.
Cheers,
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20100717/2cd50cd6/attachment.html
More information about the SciPy-Dev
mailing list