[Python-ideas] [Python-Dev] matrix operations on dict :)

Mark Janssen dreamingforward at gmail.com
Thu Feb 9 01:03:57 CET 2012


On Wed, Feb 8, 2012 at 9:54 AM, julien tayon <julien at tayon.net> wrote:

> 2012/2/7 Mark Janssen <dreamingforward at gmail.com>:
> > On Mon, Feb 6, 2012 at 6:12 PM, Steven D'Aprano <steve at pearwood.info
> > wrote:
> >
> > I have the problem looking for this solution!
> >
>
{ "a" : 1 } + { "a" : { "b" : 1 } } == KABOOM. This a counter example
> proving it does not handle all structures.
>
> Ah, but I already anticipated this.  One just has to decide the
relationship between the *group* and the *atomic*.  (These are key words
that you can find out about at pangaia.sf.net "grouping model").

Admittedly, this might be arbitrary, but once decided you get the full
power of the recursive data structure.   It's kind of like defining the
base case of factorial.  The math (in my world) simply decided that
factorial(0)=1 as the convention of "an empty product"
(Wikipedia::Factorial).

But, in theory, it should work and provide considerable power.  Since it's
all arbitrary one shouldn't get hung up too much on which convention is
adopted, even though it will have to be followed thereafter.  But "practice
beats purity", as they say... :)

mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120208/de484c26/attachment.html>


More information about the Python-ideas mailing list