сериализация и десериализация лямбд

Я хотел бы сериализовать на машине A и десериализовать на машине B лямбда-питон. Есть несколько очевидных проблем с этим:

the pickle module does not serialize or deserialize code. It only serializes the names of classes/methods/functions some of the answers I found with google suggest the use of the low-level marshal module to serialize the func_code attribute of the lambda but they fail to describe how one could reconstruct a function object from the deserialized code object marhshal(l.func_code) will not serialize the closure associated with the lambda which leads to the problem of detecting when a given lambda really needs a closure and warning the user that he is trying to serialize a lambda that uses a closure

Следовательно, мой вопрос (ы):

how would one reconstruct a function from the deserialized (demarshaled) code object ? how would one detect that a given lambda will not work properly without the associated closure ?

Ответы на вопрос(2)

Ваш ответ на вопрос