[PYTHON MATRIX-SIG] New pretty printer

Konrad HINSEN hinsenk@ere.umontreal.ca
Wed, 7 Feb 1996 17:13:56 -0500


   Perhaps precision is a poor term.  "output precision" is fine with me.

I guess the name is the least problem... The main question remains: If
precision becomes a property, what is the precision of a+b, if a has
precision 2 and b has precision 7? And why? If this question doesn't make
sense, then output precision should not be an attribute.

   My opinion is based on two ideas:

      - The output precision is needed specifically for printing arrays, mainly
	because you have lots of data to output.

Needed, yes. But it makes sense and could be easily implemented for
scalars as well.

      - Global variables are bad.  A correlary is that changes to core things like
	sys is bad. I don't mind output width beig added to sys, because it
   clearly      is not array specific.  (Well, maybe I do. :)

Line width is just as much array specific, as long as no other module
makes use of it.

I think we are overly dramatizing the "global variable" problem here.
There is very little reason to change this global variable except for
interactive use. Any module that want output with a specific format
would call the output function Numeric.arrayToString() directly and
supply line width and precision as optional arguments. The default
values from the global variables would be used *only* when someone
writes "print a". They should be set only by the end user, never by
any library code.

-------------------------------------------------------------------------------
Konrad Hinsen                     | E-Mail: hinsenk@ere.umontreal.ca
Departement de chimie             | Tel.: +1-514-343-6111 ext. 3953
Universite de Montreal            | Fax:  +1-514-343-7586
C.P. 6128, succ. Centre-Ville     | Deutsch/Esperanto/English/Nederlands/
Montreal (QC) H3C 3J7             | Francais (phase experimentale)
-------------------------------------------------------------------------------

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

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