Live data from Hacker News

DotDict: A simple Python library to make chained attributes possible

github.com

51–55 of 55 posts

Re: DotDict: A simple Python library to make chained attributes possible

#53

My general rule is, if I have a dict with a fixed set of keys, it should be a dataclass. Problem solved! Then if I need to send or receive it, it's an easy conversion to a Pydantic BaseModel.

Can dataclasses be serialized just as easily?

[dead]

Re: DotDict: A simple Python library to make chained attributes possible

#55
post #41

Earlier quoted context omitted.

Be aware that pickle is unsafe (as documented near the top of https://docs.python.org/3/library/pickle.html ), so prefer other serialization formats except between trusted processes

I can't remember the last time I _wanted_ to pickle something. Parquet and JSON pretty much cover it for me. I guess pickling made more sense before tools like Pydantic were good and popular? If I want all the python-specific nuance on disk, I know I'm in a bad place!

I use pickle to serialize RPC requests between internal services. Nothing beats it in terms of speed and ease of use.
Post reply on HN