Python evolution: Unease

Robert Kern rkern at ucsd.edu
Wed Jan 5 20:25:08 EST 2005


Bulba! wrote:
> On Wed, 5 Jan 2005 07:37:25 -0600, Skip Montanaro <skip at pobox.com>
> wrote:

> I've never needed numeric stuff either. I just need to do things like:
> 
> .>>> table.sort(column_name) # that obviously would sort rows of table
> by the values of column column_name

[snip for brevity]

> Now suppose a programmer could write a custom complement function
> that detects all the irregularly distributed "anomalous" data points
> (be it whatever, missing surnames from personnel records or values
> from a physical experiments that are below some threshold) in this
> table and returns, say, a list of tuples that are coordinates of those
> data points. Getting it from a specific table would be a matter of one
> instruction!
> 
> Yes, I know, it can be written by hand. But by this line of logic why
> bother learning VHLL and not just stay with C? 

I'm not sure what you mean by "written by hand." Someone is going to 
have to write the functions in the first place. Sure, they can be 
written once, well, and placed in the standard library so they don't 
have to be *re*written by anyone else again.

I still think numarray is a good start for this. It handles more than 
just numbers. And RecArray (an array that has different types in each 
column, as you seem to require) can be subclassed to add these methods 
to it.

>>If it's deemed useful I'm sure someone from that
>>community could whip something out in a few minutes.  The concepts
>>represented by the csv module are a lot shallower than those represented by
>>Numarray.
> 
> 
> True, and I may scratch enough time together to learn all the
> necessary stuff (I'm not even half done in learning Python)
> to write it myself. 
> 
> That is not the point, however: the biggest boost and one of the 
> main points of getting into Python, at least for me, but I'm sure
> this is also motivation for quite a lot of other people, is precisely 
> the ease of exploiting capabilities of data structures like
> dictionaries and lists, which when coupled with this data structure's
> object-style .method are simply very convenient and fast. This is 
> where IMHO Python excels among the VHLL languages.
> 
> I'm about to post reworked version of my program that doesn't
> use a _single_ traditional loop to do all the data transformations
> I need (I just still need to solve some problems there / polish
> it).  
> 
> This is not just about that damn CSV file that I already have 
> the way I wanted it and sent it to customer, this is about _terse
> and clear_ manipulations of rich data structures in Python. Why not
> extend them with flexible tables / matrices / arrays that would work
> in as "Pythonic" ways as dictionaries and lists already do?

Sure. We're working on it! Come check out numarray; I think you'll like 
it. And if, along the way, you write a CSV-to-RecArray converter, we'd 
*love* to include it in the distribution. I think that a more complete 
integration with the other core Python facilities like the csv module 
will help numarray become more suited for inclusion into the standard 
library.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter



More information about the Python-list mailing list