Added get_container_type to get_zero_value

This commit is contained in:
Vitalik Buterin 2019-06-14 14:07:25 -04:00 committed by protolambda
parent 5ddfe34f0c
commit 7c4232455c
1 changed files with 2 additions and 0 deletions

View File

@ -118,6 +118,8 @@ class Container(object):
def get_zero_value(typ): def get_zero_value(typ):
if typ == int: if typ == int:
return 0 return 0
elif is_container_type(typ):
return typ(**{f: get_zero_value(t) for f, t in typ.get_fields()})
else: else:
return typ.default() return typ.default()