Implicit lists

Chad Netzer cnetzer at mail.arc.nasa.gov
Fri Jan 31 05:59:14 CET 2003


On Thu, 2003-01-30 at 20:30, Christian Tismer wrote:

> With numeric arrays, it is *typical* to have
> a multi dimensional array. In most cases, you
> will want to have an array of a given dimensionality
> as an argument, less likely a list of arrays.

I see what you are saying.  But for example, tonight I'm working on some
plotting utilities, to plot 1-d vectors.  I want to be able to plot 1
vector or n vectors.  But I don't want to plot a matrix (a 2d array);
that's a different plot, in my mind.

So, dealling with tuples of vectors for plotting is just an easier
concept to deal with (in my mind) than putting things into a matrix
form, and in fact, I really want to differentiate the two (in this
case).  There are certain interface issues I have to deal with in my
plotting routines because of it.

If I just made my list of vectors into a matrix, I'd perhaps have less
interface issues (ie. I can just expect a matrix), but then users would
have to take steps to assemble the vectors with the right orientation
(ie. as columns, or as rows) and that makes more work and inconvenience
when using the routines.

> This appears to be a situations where two concepts of
> flexibility are fighting each other.

Exactly right;  I'm happy that flexibility gives me a simpler to use
interface, but I have to be more careful as an implementer as to what
should be reasonably expected by the user when they call my routines (at
least in this case; and I'm the primary user so I can fit my own style
pretty easily :) )


> if-the-interface-is-difficult-then-it's-wrong - ly y'rs - chris

And easy to use can be difficult to implement (of course)

-- 
Bay Area Python Interest Group - http://www.baypiggies.net/

Chad Netzer
(any opinion expressed is my own and not NASA's or my employer's)







More information about the Python-list mailing list