Python: Alternatives to pickling a module

前端 未结 2 864
盖世英雄少女心
盖世英雄少女心 2021-01-14 17:49

I am working on my program, GarlicSim, in which a user creates a simulation, then he is able to manipulate it as he desires, and then he can save it to file.

I recen

2条回答
  •  时光取名叫无心
    2021-01-14 18:21

    If you have the original code for the simulation package modules, which I presume are dynamically generated, then I would suggest serializing that and reconstructing the modules when loaded. You would do this in the Project.__getstate__() and Project.__setstate__() methods.

提交回复
热议问题