[Python-ideas] matrix operations on dict :)

Sturla Molden sturla at molden.no
Wed Feb 8 17:21:12 CET 2012

On 08.02.2012 13:12, julien tayon wrote:

> * Because it naturally provides matrix. And matrix are an easy way to
> formalize and standardize tree manipulations which are a growing
> concern in real life computer craft.

No, it naturally provides a hash-table, which is a simple in-memory 
database, not a matrix.

> at my very personnal opinion, mathematical signs should have been
> reserved in all langages to operation analog to mathematics. And
> linear algebrae is one of the most accpeted behaviour for these
> symbols.

There is a world beyond linear algebra. Sometimes we need to do things 
that cannot easily be fit into the semantics of matrix operations. And 
for those that only can think in terms of matrices there are languages 
called Matlab, Scilab, and Octave.

> It is stupid to code matrix with an hash, I just say as there is a
> strong analogy between dict and vectors,

No there is not. A vector is ordered, a hash-table (dict) is unordered.

- In a vectorlike structure, e.g. a Python list, element i+1 is stored 
subsequently to element i.

- In a hash-table, e.g. a Python dict, element hash(i+1) is not stored 
subsequently to element hash(i).


More information about the Python-ideas mailing list