[PYTHON MATRIX-SIG] New pretty printer

Jim Fulton, U.S. Geological Survey jfulton@usgs.gov
Tue, 6 Feb 1996 09:32:18 -0500


On Feb 6,  9:21am, James Hugunin wrote:
> Subject: Re: [PYTHON MATRIX-SIG] New pretty printer
>
>    From: hinsenk@ere.umontreal.ca (Konrad HINSEN)
>
>       I didn't look yet at how you did it but perhaps a user-settable
>       precision could be managed. I have done that in both Basis and
>
>    Just implemented :-) The problem with both this and the line width is
>    that there is no convenient way to set them when simply printing
>    arrays.  Right now, you have to call the function arrayToString()
>    explicitly with additional parameters. I could of course define global
>    variables in module Numeric to handle this, but I am not sure whether
>    that is a good idea. Maybe a good compromise is optional parameters
>    that are set from global variables if undefined.  Comments?
>
> The compromise approach sounds perfect.  I think that this is one of
> those rare cases where there is no potential for problems to be caused
> by global variables because you are not going to be altering the
> results of any computation, only the way those results are displayed.

But other modules may have different display needs, so you can still effect a
different piece of code.

> Without global variables there is just no reasonable way to alter the
> default behavior for "print a".

You could make this parameter a part of the state of an array.

Jim

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

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