module llutil.collections
class Dict
access dict values as attributes.
class Counter
count values by group.
Features:
-
Get or set values using dictionary or attribute interface.
-
Returns a zero count for missing items instead of raising a KeyError.
-
a
total()
function that sums all values.
Example:
import ice
cnt = ice.Counter()
assert 0 == cnt['x']
assert 0 == cnt.x
cnt.x += 1
assert 1 == cnt['x']
assert 1 == cnt.x
cnt['y'] += 1
assert 2 == cnt.total()
method total
class ConfigDict
stores multi-level configurations easily.
Features:
-
Get or set values using dictionary or attribute interface.
-
Create empty dict for intermediate items instead of raising a KeyError.
Example: