Consistent format for setting a slice of items

This commit is contained in:
SimpleArt
2021-01-01 16:30:45 -05:00
parent 94793b1b05
commit 0386be436f
2 changed files with 7 additions and 5 deletions

View File

@ -125,13 +125,11 @@ class Population:
# Just one chromosome
if isinstance(index, int):
chromosome = to_chromosome(chromosome)
self.chromosome_list[index] = to_chromosome(chromosome)
# Multiple chromosomes
else:
chromosome = [to_chromosome(elem) for elem in chromosome]
self.chromosome_list[index] = chromosome
self.chromosome_list[index] = [to_chromosome(item) for item in chromosome]
def __delitem__(self, index):