[PYTHON MATRIX-SIG] Some thoughts on default axes.

Marko Balabanovic Marko Balabanovic <marko@cs.stanford.edu>
Thu, 22 Aug 96 12:12:43 PDT


> Konrad Hinsen wrote:
> > 
> > Jim Hugunin wrote:
> > >
> > > 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).
> > 
> > I agree, but such a naming convention is useful if it is *easier*
> > to remember, not just as easy.
> 
> This I disagree with.  The advantage of the naming convention (provided
> one can be discovered) is that you get an error if you remember
> incorrectly rather than getting a strange array back.  This to me is
> REALLY important.
> 

Don't forget there are two people involved, the writer of the code and
potentially the reader.  Of course the reader might just be the writer
3 months later after he/she has forgotten everything about it.

The naming convention might still involve work on the writers part,
looking in the manual to see whether it is fft or fft_ or whatever (or
extra debugging when the exception occurs if the wrong function name
is used).  However once the reader has learned the simple rule, then
the code should be much more obvious to understand.

Marko


.Marko Balabanovic.......Department of Computer Science....................
.Stanford University     Email: marko@cs.stanford.edu   Office: Gates 132 .
.Gates Building 1A       Phone: 415 725 8783            Fax: 415 725 1449 .
.Stanford CA 94305-9010  Url:   http://robotics.stanford.edu/people/marko .
.USA.......................................................................

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================