class_docstr: The hall of fame contains the best individual that ever lived in the
  population during the evolution. It is lexicographically sorted at all
  time so that the first element of the hall of fame is the individual that
  has the best first fitness value ever seen, according to the weights
  provided to the fitness at creation time.
  
  The insertion is made so that old individuals have priority on new
  individuals. A single copy of each individual is kept at all time, the
  equivalence between two individuals is made by the operator passed to the
  *similar* argument.
  
  :param maxsize: The maximum number of individual to keep in the hall of
                  fame.
  :param similar: An equivalence operator between two individuals, optional.
                  It defaults to operator :func:`operator.eq`.
  
  The class :class:`HallOfFame` provides an interface similar to a list
  (without being one completely). It is possible to retrieve its length, to
  iterate on it forward and backward and to get an item or a slice from it.
class_docstr_tok: ["The","hall","of","fame","contains","the","best","individual","that","ever","lived","in","the","population","during","the","evolution",".","It","is","lexicographically","sorted","at","all","time","so","that","the","first","element","of","the","hall","of","fame","is","the","individual","that","has","the","best","first","fitness","value","ever","seen",",","according","to","the","weights","provided","to","the","fitness","at","creation","time",".","The","insertion","is","made","so","that","old","individuals","have","priority","on","new","individuals",".","A","single","copy","of","each","individual","is","kept","at","all","time",",","the","equivalence","between","two","individuals","is","made","by","the","operator","passed","to","the","*","similar","*","argument",".",":","param","maxsize",":","The","maximum","number","of","individual","to","keep","in","the","hall","of","fame",".",":","param","similar",":","An","equivalence","operator","between","two","individuals",",","optional",".","It","defaults","to","operator",":","func",":","`","operator.eq","`",".","The","class",":","class",":","`","HallOfFame","`","provides","an","interface","similar","to","a","list","(","without","being","one","completely",")",".","It","is","possible","to","retrieve","its","length",",","to","iterate","on","it","forward","and","backward","and","to","get","an","item","or","a","slice","from","it","."]
docstr: Update the hall of fame with the *population* by replacing the
  worst individuals in it by the best individuals present in
  *population* (if they are better). The size of the hall of fame is
  kept constant.
  
  :param population: A list of individual with a fitness attribute to
                     update the hall of fame with.
docstr_tok: ["Update","the","hall","of","fame","with","the","*","population","*","by","replacing","the","worst","individuals","in","it","by","the","best","individuals","present","in","*","population","*","(","if","they","are","better",")",".","The","size","of","the","hall","of","fame","is","kept","constant",".",":","param","population",":","A","list","of","individual","with","a","fitness","attribute","to","update","the","hall","of","fame","with","."]
code: def update(self, population):
      """Update the hall of fame with the *population* by replacing the
      worst individuals in it by the best individuals present in
      *population* (if they are better). The size of the hall of fame is
      kept constant.
  
      :param population: A list of individual with a fitness attribute to
                         update the hall of fame with.
      """
      for ind in population:
          if len(self) == 0 and self.maxsize != 0:
              # Working on an empty hall of fame is problematic for the
              # "for else"
              self.insert(population[0])
              continue
          if ind.fitness > self[-1].fitness or len(self) < self.maxsize:
              for hofer in self:
                  # Loop through the hall of fame to check for any
                  # similar individual
                  if self.similar(ind, hofer):
                      break
              else:
                  # The individual is unique and strictly better than
                  # the worst
                  if len(self) >= self.maxsize:
                      self.remove(-1)
                  self.insert(ind)
  
imports: from bisect import bisect_right
  from collections import defaultdict
  from copy import deepcopy
  from functools import partial
  from itertools import chain
  from operator import eq
label_desc: Use image node_id 2 for calling the HallOfFame obj's underlying member method code with example usage: obj.update(population) without return types