Using msgpack-python with nested namedtuples

Viewed 1620

My data structure is like this:

user = UserTuple(
    name=u'Anakin', surname=u'Skywalker', birthdate=datetime.date(1981, 7, 25),
    profile=ProfileTuple(avatar=u'http://localhost/profile.jpg')
)

And I want to pack this data with msgpack-python module. But msgpack converts namedtuples to lists. It can be possible pack data like this with msgpack and preserve namedtuples, just like pickle/cpickle?

2 Answers
Related