22 ms·
In case anyone is looking for mature alternatives that are used in production https://pypi.org/project/python-box/ https://pypi.org/project/python-box/ https:
by sidmitra 3y ago
In case anyone is looking for mature alternatives that are used in production
https://pypi.org/project/python-box/ https://pypi.org/project/python-box/
https://pypi.org/project/munch/ https://pypi.org/project/munch/
- Halvedat 3y agoNeither of these appear to have the chained attribute feature, from my surface level parse.
- nmalaguti 3y agoBox can do it with https://github.com/cdgriffith/Box/wiki/Types-of-Boxes#default-box https://github.com/cdgriffith/Box/wiki/Types-of-Boxes#defaul...
- sidmitra 3y agoIt's there on the readme/pypi home for both; unless i'm misunderstanding what you mean by "chained" from box import Box movie_box = Box({ "Robin Hood: Men in Tights": { "imdb stars": 6.7, "length": 104 } }) movie_box.Robin_Hood_Men_in_Tights.imdb_stars from munch import Munch b = Munch() b.hello = 'world' b.foo = Munch(lol=True) b.foo.lol
- Izkata 3y agoChained means in your second example this would work without manually creating a new instance: b.foo.lol = True
- jperras 3y agopython-box does this in the most intuitive way possible: >>> from box import Box >>> empty_box = Box(default_box=True) >>> empty_box.a.b.c.d.e.f.g # <Box: {}>
- make3 3y agoMunch is an unfortunate name
- KolenCh 3y agoHow does these compare to glom? https://glom.readthedocs.io https://glom.readthedocs.io