I was wondering if there's such a thing as the __sleep()
magic function (from PHP) implemented in Python.
I'm having an issue with a class, which Python says it's not JSON serializable, and I want to return a simple dictionary from a magic method inside the class, so that one of my libs can successfully call json.dumps
on it. (I have no control of the line of code that does the serialization, as I said, it's done inside a library)