bag.util.immutable
This module defines various immutable and hashable data types.
Module Contents
Classes
An immutable homogeneous list. |
|
An immutable dictionary with sorted keys. |
Functions
|
Combine the two given hash values. |
|
Convert the given Python object into an immutable type. |
|
Attributes
- bag.util.immutable.combine_hash(a: int, b: int) int [source]
Combine the two given hash values.
Parameter
- aint
the first hash value.
- bint
the second hash value.
- returns:
hash – the combined hash value.
- rtype:
int
- class bag.util.immutable.ImmutableList(values: Optional[collections.Sequence[T]] = None)[source]
Bases:
collections.Hashable
,collections.Sequence
,Generic
[T
]An immutable homogeneous list.
- __getitem__(idx: int) T [source]
- __getitem__(idx: slice) ImmutableList[T]
- class bag.util.immutable.ImmutableSortedDict(table: Optional[collections.Mapping[T, Any]] = None)[source]
Bases:
collections.Hashable
,collections.Mapping
,Generic
[T
,U
]An immutable dictionary with sorted keys.
- copy(append: Optional[Dict[T, Any]] = None, remove: Optional[collections.Sequence[T]] = None) ImmutableSortedDict[T, U] [source]