News for hackers. Stuff that matters.
Re:Box: Python dictionaries with recursive dot notation access by ericfrederich on Friday May 05, 2017 @01:26PM (#14275147)
I got excited by the heading thinking that there was a change to the language and we could refer to the dictionary itself in dictionary comprehension.

Just yesterday I commented that if generators could refer to themselves in generator comprehension (recursion) I could express some algorithm as a single expression.

http://stackoverflow.com/a/41617394/180464

... anyway, this just turns out to be what looks like an "addict" clone.

Re:Box: Python dictionaries with recursive dot notation access by chris_griffith on Friday May 05, 2017 @02:25PM (#14275653)
Something like that would be handy. Just to clarify the addict mention.

It works similarity to addict, but does have important distinctions and IMO seniority (was in my 'reusables' pypi project named 'Namespace' before addict existed. Just finally spun it into it's own project).

Biggest differences:

* Box will convert items added to the object after creation, addict does not

* addict only acts as a defaultdict, Box can act as either regular or defaultdict

* Box updates it’s __dir__ so that attributes (keys) are tab completed in stuff like IPython

* Box repr clearly shows it is an object