[英]What is the difference between enable_pickling and pickle_suite in boost python?
我有一個相當大的 class 有大約 40 個屬性,但只有 15 個作為 arguments 傳遞給構造函數:
class MyClass{
/*40 attributes here*/
MyClass(/*15 args here, the rest are initialized at default values*/);
};
I'm trying to implement pickle support for this class, and so far the boost.python documentation seems to indicate that I can either implement an instance of the pickle_suite
class, or I can just do .enable_pickling()
and let python handle the rest . 與僅使用一行代碼相比,花時間實現所有__getinitargs__
和其他東西有什么優勢嗎? 據我了解,酸洗本質上是將對象轉換為一堆 1 和 0 並傳遞它。
謝謝
沒關系,看起來普通的 python pickler 無法復制容器內的元素,如 std::vector 或 std::pair
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.