[PYTHON MATRIX-SIG] Some thoughts on default axes.
Thu, 22 Aug 1996 14:48:21 -0400
Konrad Hinsen wrote:
> Jim Hugunin wrote:
> > I really don't think that a complete set of both function should be
> > provided. The great value in this proposal is it lets me define the
> > "proper" default axis for each function without fear of people not being
> > able to remember which one that is.
> That supposes that the naming convention is easier to remember than
> the default axis, which is not obvious to me. I can imagine people
> wondering whether the correct function is fft or fft_.
I'd argue here that if you can remember that fft operates on the -1
axis, you can remember that all functions that operate by default on the
-1 axis have an underscore after them (which by the way is not a naming
convention I find reasonable).
What I like about this is that if you forget that fft operates on
axis=-1 by default you get an exception (for example the name fft is
undefined). Otherwise, you instead get a perfectly legal array back
who's values are completely different from what you expected. I find
these bugs extremely hard to track down (from personal experience).
Your concern about people wondering whether it's fft or fft_ is exactly
my concern about people wondering if its axis=-1 or axis=0.
> > If the names of these functions somehow made their categories obvious,
> > then I'd be happy to set the default axis for the nonstructural
> > operations to be -1.
> I can't think of a naming scheme that would work like that.
I can't either, but I do think this would be a fine solution if somebody
can come up with the right names.
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: firstname.lastname@example.org
administrivia to: email@example.com