[PYTHON MATRIX-SIG] changes to compress

Konrad HINSEN hinsenk@ere.umontreal.ca
Fri, 16 Feb 1996 09:23:01 -0500


   Right now it raises an exception. I think it should return some
   NULL-type object, either None, [] or maybe an empty array object if
   such a thing exists. 

It should definitely return an empty array object. And all the array
functions should be able to deal with empty arrays without raising
exceptions. As any APL programmer will confirm, empty arrays occur
very often in array manipulations. It is even necessary to keep the
correct shapes for empty arrays, i.e. an array of shape (0,2) must be
distinct from an array of shape (3,0,4), even though both contain no
elements. Therefore a generic "empty" object like None can't be
used as a substitute.

   The problem stems from array methods not accepting empty lists as
   arguments. Couldn't it just return an empty Array object, which would
   act just like any other empty mapping or sequence object?

That's what it should do.

   I noticed this while using Konrad's pretty printer - did anyone else
   notice this? Konrad?

Yes, I have even pointed it out in one of my messages about the pretty
printer.

-------------------------------------------------------------------------------
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
=================