在回答Python pickle: dealing with updated class definitions的dill包的作者寫道: 「好吧,我加入這個功能在GitHub上的最新版本比我想象的要少弄虛作假實施蘿...只是使用pickle序列化類定義,並且瞧。「 已經安裝dill與它修修補補,這不是明顯,我怎麼竟在dill使用此功能。有人能提供一個明確的例子嗎?我想醃製類實例並序列化類定義。我是
我正在試驗Dill軟件包,特別是它的檢測模塊,並且直觀地理解指代者,查閱者,父母和孩子的含義。 A reference是一個可以訪問某些數據的值。 而指示對象是referred to,對吧? 所以在下面的代碼: class MyClass:
"""A simple example class"""
i = 12345
def f(self):
return
繼續使用Dill package進行工作。昨天發佈了一些例子ignorance of referents, referrers, inheritance and containers。答案很有洞察力,但我仍然無法提出一些例子,這些例子在推薦人和指稱鏈中顯示出幾個層次的深度。 昨天我在想,instance將是一個referrer到它的類。在迪爾文檔孩子是引薦,所以在這種情況下,孩子的depth=2將
更多挖入蒔蘿。特別是給呼叫detect.at方法: def _locate_object(address, module=None):
"""get object located at the given memory address (inverse of id(obj))"""
special = [None, True, False] #XXX: more...?