19
Stop using pickle already. Seriously, stop it!
(mina86.com)
Welcome to the Python community on the programming.dev Lemmy instance!
Past
November 2023
October 2023
July 2023
August 2023
September 2023
The thing is, none of the suggested alternatives can do what pickle does, and the article focuses on a narrow (albeit ubiquitous) use case: serialisation of untrusted data.
There are still legitimate use cases for pickle, especially when storing, caching, or comparing objects that can't easily be serialised with say, JSON or TOML. It's a question of using the right thing for the right job is all, and pretending like JSON is a computable alternative to pickle doesn't help anyone.
If you’re serialising trusted data, you can define schema for it and use Protocol Buffers which will not only by safer but also faster. Pretending that you need to be able to serialise arbitrary data hurts everyone.
I second this.