On Sep 22, 2013, at 6:50 PM, Matthew Rocklin <notifications@github.com> wrote:

> In toolz/dicttoolz/core.py:
> 
> > +    """
> > +    return dict(list(d.items()) + [(q, r)])
> > +
> > +
> > +def update_in(dikt, keys, f):
> > +    """ Immutably update value in a (potentially) nested dictionary.
> > +
> > +    keys is a list or tuple or anything which supports indexing, which
> > +    gives the "location" of the value in dikt; f is the function which
> > +    operates on the value to produce an updated value.
> > +
> > +    Translated from Clojure,
> > +    http://clojuredocs.org/clojure_core/1.2.0/clojure.core/update-in
> > +
> > +    >>> update_in({"x": {"a": 33}}, ["x", "a"], str)
> > +    {'x': {'a': '33'}}
> It took me a minute to understand this example.
> 
> The action of the str function isn't very visible.
> 
> Also the dict of dicts requires a significant amount of parsing. I might put it on another line.
> 

Put what on another line, exactly?
> A real-world example might make it more clear why this example is useful.
> 
> 

I had/have a real world example, but it is significantly harder to understand than this example.


> —
> Reply to this email directly or view it on GitHub.
>