[Numpy-discussion] A possible addition to PEP 209

Chris Barker chrishbarker at home.net
Thu Sep 6 15:54:06 CDT 2001


Hi all,


I started a recent dission on c.l.p recently
(http://mail.python.org/pipermail/python-list/2001-September/063502.html),
and it brought up an interesting idea.

In general, I'd like to see Python become more array-oriented, which PEP
209 and friends will help with. I want this because it provides a
natural and effecient way of expressing your program, and because there
are large oportunities for performance enhancements. WHile I make a lot
of use of NumPy arrays at the moment, and get substantial performance
benefits when I can use the overloaded operators and ufuncs, etc. Python
itself still doesn't know that a NumPy array is a homogenous sequence
(or might be), because it has no concept of such a thing. If the Python
interpreter knew that it was homogenous, there could be a lot of
opportunities for performance enhancements.

In the above stated thread, I suggested the addition of a "homogenous"
flag to sequences. I havn't gotten an enthusiastic response, but Skip
Montanaro suggested:

"""
One approach might be to propose that the array object be "brought into
the fold" as a builtin object and modifications be made to the virtual
machine so that homogeneity can be assumed when operating on arrays.
"""

PEP 209 does propose that an array object be "brought into the fold" (or
does it? would it be a builtin?, if not, at least being part of the
standard library would be a help ), but it makes no mention of any
modifications to the virtual machine that would allow optimisations
outside of Numeric2 defined functions.

Is this something worth adding?  I understand that it is one thing for
the homogenous sequence (or array) to be acknowledged in the VM, and
quite another for actual optimizations to be written, but we need the
former before we can get the latter.

What do you all think??


-Chris


-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------




More information about the Numpy-discussion mailing list