[PYTHON MATRIX-SIG] scalars and arrays

Konrad Hinsen hinsen@ibs.ibs.fr
Tue, 29 Oct 96 15:18:36 GMT


> Many of the procedures I write in IDL permit the user to select any
> set of energy channels and/or species on which to operate.  This is
> usually done via a scalar index or an array of indexes.  Your
> array(a).flat trick (could even use it via map() as an idiom for
> converting a tuple of scalars or sequences) will solve the problem and
> allow me the function to be coded independent of the users input of a
> sequence or scalar.

If it's for input processing then the conversion approach makes sense.
It's also a standard technique in APL (where of course input plus
conversion to a rank-1 array is done with just two characters).

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-76.88.54.94
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais
-------------------------------------------------------------------------------

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

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