When can a Python object be pickled

前端 未结 4 944
野性不改
野性不改 2021-02-19 08:20

I\'m doing a fair amount of parallel processing in Python using the multiprocessing module. I know certain objects CAN be pickle (thus passed as arguments in multi-p) and other

4条回答
  •  误落风尘
    2021-02-19 08:48

    In addition to icedtrees' answer, also coming straight from the docs, you can customize and control how class instances are pickled and unpicked, using the special methods: object.__getnewargs_ex__(), object.__getnewargs__(), object.__getstate__(), object.__setstate__(state)

提交回复
热议问题