News for hackers. Stuff that matters.
Re:Box – Python dictionary with dot notation by MaxMoney on Friday December 17, 2021 @06:08PM (#29599437)
You can get away with a single hashed dict:

from types import SimpleNamespace

mydict = { "name": "moe", "age": 3, "test": {"name": "josh"} # wont work }

dotted = SimpleNamespace(*mydict)

print(dotted.name, dotted.age) # moe 3

Re:Box – Python dictionary with dot notation by kkirsche on Saturday December 18, 2021 @03:12PM (#29608086)
If you don’t mind the heavier weight / newer version requirements, dataclasses from the standard lib also seem to solve this problem.
Re:Box – Python dictionary with dot notation by whalesalad on Friday December 17, 2021 @10:16PM (#29601246)
namedtuple is my usual goto for this but problem but I am glad to learn of SimpleNamespace
Re:Box – Python dictionary with dot notation by youssefabdelm on Saturday December 18, 2021 @03:53AM (#29602969)
Exactly my thought...I wonder how the Box library differs.
Re:Box – Python dictionary with dot notation by MaxMoney on Sunday December 19, 2021 @09:42PM (#29621010)
it probably does nested dicts