@@ -593,19 +593,15 @@ def __getitem__(self, i):
593593
594594 )):
595595 wip_perm_sequence_dict [j ] = unused_value
596- sequence = [item for item in self .sequence
597- if item not in shit_set ]
598- if any (value in shit_set for value
599- in wip_perm_sequence_dict .values ()):
600- candidate_sub_perm_space_length = 0
601- else :
602- candidate_sub_perm_space_length = \
603- PermSpace ._create_with_cut_prefix (
604- sequence ,
605- n_elements = self .n_elements ,
606- fixed_map = wip_perm_sequence_dict ,
607- is_combination = self .is_combination
608- ).length
596+
597+ candidate_sub_perm_space_length = \
598+ PermSpace ._create_with_cut_prefix (
599+ self .sequence ,
600+ n_elements = self .n_elements ,
601+ fixed_map = wip_perm_sequence_dict ,
602+ is_combination = self .is_combination ,
603+ shit_set = shit_set
604+ ).length
609605
610606 if wip_i < candidate_sub_perm_space_length :
611607 available_values .remove (unused_value )
@@ -920,7 +916,7 @@ def _coerce_perm(self, perm):
920916 @classmethod
921917 def _create_with_cut_prefix (cls , sequence , domain = None , * ,
922918 n_elements = None , fixed_map = None , degrees = None , is_combination = False ,
923- slice_ = None ):
919+ slice_ = None , shit_set = frozenset () ):
924920
925921 # Tricky thing here: Trying to put as much as we can in a
926922 # sequence head that'll shorten the sequence we'll give to
@@ -952,9 +948,9 @@ def _create_with_cut_prefix(cls, sequence, domain=None, *,
952948 sequence [sequence .index (item )] = misc .MISSING_ELEMENT
953949 # More efficient than removing the element, we filter these out
954950 # later.
955- if not is_combination :
956- sequence = [ item for item in sequence
957- if ( item is not misc . MISSING_ELEMENT ) ]
951+
952+ shit_set = { misc . MISSING_ELEMENT } | shit_set
953+ sequence = [ item for item in sequence if item not in shit_set ]
958954
959955 fixed_map = {key - len (prefix ): value
960956 for key , value in fixed_map .items ()}
0 commit comments