deepfos.lib.utils.get_groupdicts

deepfos.lib.utils.get_groupdicts(n=1)

获取 n 个字典,其中的键值共享一个集合,在字典间保持唯一

>>> a, b, c = get_groupdicts(3)
>>> a,b,c
({}, {}, {})
>>> a['a'] = 1
>>> a,b,c
({'a': 1}, {}, {})
>>> a.pop('a')
1
>>> b['a'] = 2
>>> c['a'] = 3
Traceback (most recent call last):
  ...
KeyError: 'Key a has been existed in key_group. Cannot be added to current dict.'
>>> a,b,c
({}, {'a': 2}, {})

参见

GroupDict

返回类型

Tuple[GroupDict, …]