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.
SimpleSequencefeatures 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
SimpleSequencewas to grant classes likeClauseandCNFthe ability to be initialized with literals without needing to duplicate that code.SimpleSequenceis atyping.MutableSequencewith all the expected functionality, and it also provides built-in support forcopy.copy()andcopy.deepcopy().SimpleSequencewas also built to support better type-checking throughout SweetPea. To that effect, the implementation was inspired by discussion in mypy issue #4108.