Binary package “python3-frozenlist” in ubuntu jammy
list-like structure which implements collections.abc.MutableSequence
`frozenlist.
`collections.
is called, after which list modifications raise `RuntimeError`:
.
>>> from frozenlist import FrozenList
>>> fl = FrozenList([17, 42])
>>> fl.append('spam')
>>> fl.append(
>>> fl
<FrozenList(
>>> fl.freeze()
>>> fl
<FrozenList(
>>> fl.frozen
True
>>> fl.append("Monty")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "frozenlist/
self.
File "frozenlist/
raise RuntimeError(
RuntimeError: Cannot modify frozen list.
.
FrozenList is also hashable, but only when frozen. Otherwise it also throws a RuntimeError:
.
>>> fl = FrozenList([17, 42, 'spam'])
>>> hash(fl)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "frozenlist/
raise RuntimeError(
RuntimeError: Cannot hash unfrozen list.
>>> fl.freeze()
>>> hash(fl)
3713081631934
>>> dictionary = {fl: 'Vikings'} # frozen fl can be a dict key
>>> dictionary
{<FrozenList(
Source package
Published versions
- python3-frozenlist 1.2.0-1build1 in amd64 (Proposed)
- python3-frozenlist 1.2.0-1build1 in amd64 (Release)
- python3-frozenlist 1.2.0-1build1 in arm64 (Proposed)
- python3-frozenlist 1.2.0-1build1 in arm64 (Release)
- python3-frozenlist 1.2.0-1build1 in armhf (Proposed)
- python3-frozenlist 1.2.0-1build1 in armhf (Release)
- python3-frozenlist 1.2.0-1build1 in ppc64el (Proposed)
- python3-frozenlist 1.2.0-1build1 in ppc64el (Release)
- python3-frozenlist 1.2.0-1build1 in riscv64 (Proposed)
- python3-frozenlist 1.2.0-1build1 in riscv64 (Release)
- python3-frozenlist 1.2.0-1build1 in s390x (Proposed)
- python3-frozenlist 1.2.0-1build1 in s390x (Release)