typed_python
typed_python copied to clipboard
Can't serialize some kinds of bound methods
Our methodology for serializing core python objects works for lots of things, but not certain kinds of types and methods. For instance
import numpy
import typed_python.Codebase as Codebase
sc = Codebase.Codebase.coreSerializationContext()
sc.serialize(numpy.array) # throws
sc.serialize(numpy.array([1,2,3])) # OK
sc.serialize(numpy.array([1,2,3]).max) # throws
sc.serialize(numpy.max) # throws
throw errors where named. We should be able to serialize any of these.
We can now serialize 'numpy.array', but not the method. Nor can we serialize bound methods of regular classes.
We should really just support the reduce protocol for objects like these
c.f #417