[PYTHON MATRIX-SIG] casting and default types

Hinsen Konrad hinsenk@ere.umontreal.ca
Tue, 7 Nov 1995 14:43:37 -0500


   The current instantiation (and lack of coercion) system is Jim Fulton's  
   (more or less) and he could do a much better job of defending it than me.   
   The principle issue is that automatic type coercions can hide bugs.  The  

Whether or not coercion is a good idea is an old argument, but
for Python it has long been decided: Python has coercion, and
not having it for matrices would be simply inconsistent.

   other issue is that automatic coercion can hide efficiency problems.  If I  
   have a vector of ints that I'm frequently going to have to multiply by  
   different vectors of floats, then it would be much more efficient for me to  
   convert it to a vector of floats one time.  If I have automatic type  

I'd suppose that people who need the highest possible performance
are aware of this problem and are watching out for it. There
is a profiler for Python that can help find such problems. I don't
see this as a valid reason Python inconsistent and most users'
life more difficult.

   This is why I mentioned this issue as something that might be amenable to  
   some sort of flag in the same way that IEEE exceptions could be (I was just  

That's of course a possible solution, if someone thinks this
is really important.

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