msgpack/msgpack-rpc-python — pull request #8 by kuenishi (2012-04-05 08:07:35+00:00)
Title: add default serialization method for idl-defined message classes

objects with to_msgpack() method will be able to be sent.
giving deserialization hints (type specs) to the server will be a bit complicated thus it will be done in idl-generated codes.

it will be like this:
```python
class SomeMsg:
def __init__(self, key, value):
self.key = key
self.value = value

def to_msgpack(self):
return (self.key, self.value)

@staticmethod
def from_msgpack(key, value):
return SomeMsg(key, value)
```
If 'value' is also a user-defined class, deserializer will be generated as follows:
```python
@staticmethod
def from_msgpack(key, value):
return SomeMsg(key, ValueClassname.from_msgpack(value))
```
If 'value' is also a list of a user-defined class, deserializer will be generated as follows:
```python
@staticmethod
def from_msgpack(key, values):
return SomeMsg(key, [ValueClassname.from_msgpack(v) for v in values)
```