kwgoodman / la

Meet larry, the labeled numpy array
http://pypi.python.org/pypi/la
Other
44 stars 20 forks source link

ENH added arange(), zeros(), ones() #46

Closed stroxler closed 12 years ago

stroxler commented 12 years ago

Closes #15

kwgoodman commented 12 years ago

These functions will come in handy!

Can you add the .. autofunction:: la.ones etc to the sphinx doc?

kwgoodman commented 12 years ago

I noticed that in numpy np.ones and np.zeros just call np.empty with fill values of 1 and 0, respectively.

Maybe we should go that way too? So if we made a la.empty then la.ones and la.zeros could use that and just fill the arrays. That would be cleaner (less duplicate code) plus it would give us a la.empty function.

stroxler commented 12 years ago

I can do that. Empty() can't be tested easily, but that is no problem. I guess you could view the other tests as testing it.

kwgoodman commented 12 years ago

Could you add See Also sections? ones, zeros, empty, lrange could all be in each others docstrings.

stroxler commented 12 years ago

The _args and *_kwargs cannot be dropped if we want the function to behave the way we had initially decided. But we could make it follow the same rules that the others follow, in which case they can be.

The issue is that without _args, you can't get something like la.lrange(5,4,3) to work. It would have to be la.lrange((5,4,3)). That's why all these functions had args and _kwargs in the first place. But I don't see a strong reason to prefer the current call. It is more convenient, but if the docstring is confusing does that matter?

kwgoodman commented 12 years ago

Good point. Let's go with the shape input so that lrange matches la.ones, zeros and empty instead la.rand, randn.

stroxler commented 12 years ago

That was a typo. Should be fixed now.