[Numpy-discussion] matrix indexing question

Fernando Perez fperez.net at gmail.com
Tue Mar 27 16:51:32 EDT 2007


On 3/27/07, Alan G Isaac <aisaac at american.edu> wrote:
> Hi Zach,
>
> The use case I requested was for iteration over a
> matrix where it is desirable that matrices are yielded.

I'm personally not really partial to any side of this discussion,
given how I don't use matrices at all (I'm content with a simple
mental model of arrays, and use dot() as necessary).  But it's
probably worth mentioning, as a data point, that the python language
has a well established precedent for 'iteration over a FOO where a FOO
is yielded':

In [1]: s='abc'

In [2]: type(s)
Out[2]: <type 'str'>

In [3]: map(type,s)
Out[3]: [<type 'str'>, <type 'str'>, <type 'str'>]


I know strings aren't matrices, so take this as you will in terms of
being plus, neutral or minus regarding your discussion.  I'm just
offering the data, not interpreting it :)

Cheers,

f



More information about the NumPy-Discussion mailing list