boost python中的enable_pickling和pickle_suite有什么区别?
What is the difference between enable_pickling and pickle_suite in boost python?
我有一个相当大的 class,它有 ~40 个属性,但只有 15 个作为参数传递给构造函数:
class MyClass{
/*40 attributes here*/
MyClass(/*15 args here, the rest are initialized at default values*/);
};
我正在尝试为此 class 实现 pickle 支持,到目前为止 boost.python documentation 似乎表明我可以实现 pickle_suite
[=25] 的一个实例=],或者我可以只做 .enable_pickling()
,让 python 处理其余的。与仅使用一行代码相比,花时间实现所有 __getinitargs__
之类的东西有什么优势吗?据我了解,酸洗本质上是将对象转换为一堆 1 和 0 并将其传递。
谢谢
没关系,看起来正常的 python pickler 无法复制容器内的元素,例如 std::vector 或 std::pair
我有一个相当大的 class,它有 ~40 个属性,但只有 15 个作为参数传递给构造函数:
class MyClass{
/*40 attributes here*/
MyClass(/*15 args here, the rest are initialized at default values*/);
};
我正在尝试为此 class 实现 pickle 支持,到目前为止 boost.python documentation 似乎表明我可以实现 pickle_suite
[=25] 的一个实例=],或者我可以只做 .enable_pickling()
,让 python 处理其余的。与仅使用一行代码相比,花时间实现所有 __getinitargs__
之类的东西有什么优势吗?据我了解,酸洗本质上是将对象转换为一堆 1 和 0 并将其传递。
谢谢
没关系,看起来正常的 python pickler 无法复制容器内的元素,例如 std::vector 或 std::pair