[PYTHON MATRIX-SIG] Default Axes revisited

Michael McLay mclay@eeel.nist.gov
Wed, 4 Sep 1996 10:51:35 GMT


Charles G. Waldman writes:
 > 
 > Jim wrote:
 > > However, because I don't think it's always obvious what's a structural
 > and
 > > what's a numeric operation, all numeric operations will have a "_"
 > after
 > > their name.
 > 
 > Just to put in my $0.02:
 > 
 > I think that using names ending in underscores to distinguish structural
 > from numeric_ operations lacks elegance.
 > 
 > How about making another module, called Structural?
 > 
 > Then:
 > 
 > from Numeric import argsort
 > from Structural import concatenate
 > 
 > Use the already-existing Python notion of modules to make it clear which
 > operations are numeric and which are structural.  Don't introduce any new
 > and arbitrary convention about trailing underscores.
 > 
 
This solution is much better than using a naming convention.  It uses
modules to classify functions into different catagories rather than
forcing everything into a single one size fits all containter. The
docstring at the begining of the module could be used to explain the
convension used for the axis definition within the module.  

There is a problem with calling the module Structural.  Like Tkinter,
the name is too long a name for something that must be used as a
qualifier many times within a file.  This encourages importing the
name into the local namespace.  Another option on usage convension
would be:

        import Structural; S = Structural
        S.concatenate(...)

This notation make the usage of the names short, but allows someone
reading the file to see that the full name is Structural.  

Perhaps packages could also be used to further subdivide the Numerics into
more specialized collections of objects.  For instance Different
packages baed on the Numeric module could be added as specializations
of that module:

        import ni
        import Numeric.MolecularModeling; MM = Numeric.MolecularModeling

The Numeric.MolecularModeling module contains all the object
definitions used by a computational chemist.  Notations in the module
could be shortened by adding alias names for objects, not by defining the
objects using sort cryptic names.  This approach preserves the general
readability of a module, but still allows a shorter notation to be used by
the expert in the field.

Michael



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

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