kim
kim copied to clipboard
Mapper inheritance
Hi, I have some problems
# -*- coding: utf-8 -*-
from kim import field, Mapper
class A(Mapper):
__type__ = dict
a = field.Integer()
class B(Mapper):
__type__ = dict
b = field.Integer()
class C(A, B):
__type__ = dict
c = field.Integer()
sample = {'a': 1, 'b': 2, 'c': 3}
print('serialized', C(obj=sample).serialize())
print('marshalled', C(data=sample).marshal())
Output is:
python3.7 mapper_test.py
{'a': 1, 'c': 3}
{'a': 1, 'c': 3}
Process finished with exit code 0
Is can Kim have right way to create mapper from inheritance?