[Python-Dev] Fwd: summing a bunch of numbers (or "whatevers")
Sun, 20 Apr 2003 15:38:17 +0100
On Sun, Apr 20, 2003 at 10:00:22AM -0400, Aahz wrote:
> On Sun, Apr 20, 2003, Raymond Hettinger wrote:
> > __builtin__ is already too fat. math is for floats. operator is mostly
> > for operators. Perhaps make a separate module for vector-to-scalar
> > operations like min, max, product, average, moment, and dotproduct.
> Call it "statistics". Yes, I've seen the comments about using add()/sum()
> for strings, but I think numeric usage will be by far the most common.
A lightweight vector class would be very useful; it's something I've
had to roll my own of for a lot of scientific code I'm writing (the
problem being that it's often impractical to build Numeric everywhere,
so you can't rely on having it whereas you probably can rely on at
least having Python.)
A good example is in processing of output from solid-state physics codes
(a subject very close to my heart); you want vectors to store (eg) positions
of and forces on atoms, but you don't need the performance of Numeric - and
the distribution overhead of same.
As such, this is something I've got lying around; I'd be more than willing
to distribute this (~100 line) class to whoever wants it under whatever
license they care for.
It should be easily extensible to do whatever else people want in this
regard, as well.
email: firstname.lastname@example.org http://www.lexical.org.uk/
Earth Sciences, University of Cambridge http://www.esc.cam.ac.uk/
CUR1350, 1350 MW Cambridgeshire and online http://www.cur1350.co.uk/