Earlier quoted context omitted.
I enjoy how much complete control Python enables. It’s fun to turn it into what resembles a different language. I want to make a library where you never ever call functions with fn() notation. But just utilize accessors and absolutely bastardize dicts.
My favorite example of this: https://old.reddit.com/r/learnprogramming/comments/kegalv/my...
DotDict: A simple Python library to make chained attributes possible
21–30 of 55 posts
Re: DotDict: A simple Python library to make chained attributes possible
#22This is more of a political statement than a proper library. More to demonstrate the flexibility of Python given I was able to so easily do this.
Could have been even easier: `argparse.Namespace` already has `__contains__()` ツ That said, https://pypi.org/project/addict/ has been around a long time...
Yes, addict seems to be exactly what I was going for.
Re: DotDict: A simple Python library to make chained attributes possible
#23Re: DotDict: A simple Python library to make chained attributes possible
#24edict() is an interesting name for a dictionary function.
Re: DotDict: A simple Python library to make chained attributes possible
#25In case anyone is looking for mature alternatives that are used in production https://pypi.org/project/python-box/ https://pypi.org/project/munch/
Re: DotDict: A simple Python library to make chained attributes possible
#26https://github.com/cdgriffith/Box/wiki/Types-of-Boxes#defaul...
Re: DotDict: A simple Python library to make chained attributes possible
#27In case anyone is looking for mature alternatives that are used in production https://pypi.org/project/python-box/ https://pypi.org/project/munch/
Neither of these appear to have the chained attribute feature, from my surface level parse.
https://github.com/cdgriffith/Box/wiki/Types-of-Boxes#defaul...
Re: DotDict: A simple Python library to make chained attributes possible
#28Earlier quoted context omitted.
I enjoy how much complete control Python enables. It’s fun to turn it into what resembles a different language. I want to make a library where you never ever call functions with fn() notation. But just utilize accessors and absolutely bastardize dicts.
My favorite example of this: https://old.reddit.com/r/learnprogramming/comments/kegalv/my...
Re: DotDict: A simple Python library to make chained attributes possible
#29Then if I need to send or receive it, it's an easy conversion to a Pydantic BaseModel.
Re: DotDict: A simple Python library to make chained attributes possible
#30https://pypi.org/project/jsane/
Its syntax is a bit uglier, though.