[PEP draft 2] Adding new math operators

Robin Becker robin at jessikat.fsnet.co.uk
Thu Aug 10 05:38:19 EDT 2000


In article <m3aeel8oin.fsf at chinon.cnrs-orleans.fr>, Konrad Hinsen
<hinsen at cnrs-orleans.fr> writes
>Tim Hochberg <tim.hochberg at ieee.org> writes:
>
>> Values can be scalars, just not arbitrary scalars. I consider rank 0
>> arrays scalars and they would work fine. It's core python numeric
>> types that would not work (ints, floats and complexes). This means
>
>Some historical remarks from NumPy development:
>
>1) There was some discussion as to whether rank-0 arrays should exist
....
>Now we *are* discussing changes to the Python core, so why not go
>for the "grand unification":
>
>1) Add array/matrix objects to the core distribution.
>2) Define methods for them and implement them for the scalar types
>   as well (the implementation would in practice be shared, of course).
>3) Add the missing scalar types corresponding to single-precision
>   float and complex.
>4) Make scalars behave like rank-0 arrays in every respect (i.e.
>   having a shape attribute etc.)
>
>This would eliminate all the interoperability problems that we have
>today, but still not require any change to the language definition,
>only to the implementation.


This is the way to go if we can get it through. We need to extend the
base types if arrays/matrices are to be first class things. I doubt it
will happen for a long time though.
-- 
Robin Becker



More information about the Python-list mailing list