sweetpea.core.simple_sequence module¶
Provides a simple custom sequence type for internal use.
- class sweetpea.core.simple_sequence.SimpleSequence(first_value=None, *rest_values)¶
Bases:
MutableSequence
[sweetpea.core.simple_sequence._T
]A custom generic sequence.
SimpleSequence
features an advanced initialization mechanism that allows for automatically converting given arguments into elements of the desired type. It can also smartly handle being given lists of elements for initialization.The purpose of
SimpleSequence
was to grant classes likeClause
andCNF
the ability to be initialized with literals without needing to duplicate that code.SimpleSequence
is atyping.MutableSequence
with all the expected functionality, and it also provides built-in support forcopy.copy()
andcopy.deepcopy()
.SimpleSequence
was also built to support better type-checking throughout SweetPea. To that effect, the implementation was inspired by discussion in mypy issue #4108.