code: def refresh_items(self):
          
          old_items = self.items[:]# if self._dirty else []
          old_iter_data = self._iter_data# if self._dirty else {}
          iterable = self.windowed_iterable
          pattern_nodes = self.pattern_nodes
          new_iter_data = sortedmap()
          new_items = []
  
          if iterable is not None and len(pattern_nodes) > 0:
              for loop_index, loop_item in enumerate(iterable):
                  iteration = old_iter_data.get(loop_item)
                  if iteration is not None:
                      new_iter_data[loop_item] = iteration
                      new_items.append(iteration)
                      old_items.remove(iteration)
                      continue
                  iteration = []
                  new_iter_data[loop_item] = iteration
                  new_items.append(iteration)
                  for nodes, key, f_locals in pattern_nodes:
                      with new_scope(key, f_locals) as f_locals:
                          f_locals['loop_index'] = loop_index
                          f_locals['loop_item'] = loop_item
                          for node in nodes:
                              child = node(None)
                              if isinstance(child, list):
                                  iteration.extend(child)
                              else:
                                  iteration.append(child)
          
          # Add to old items list
          #self.old_items.extend(old_items)
          
          #if self._dirty:
          for iteration in old_items:
              for old in iteration:
                  if not old.is_destroyed:
                      old.destroy()
  
          if len(new_items) > 0:
              expanded = []
              recursive_expand(sum(new_items, []), expanded)
              self.parent.insert_children(self, expanded)
  
          self.items = new_items# if self._dirty else new_items+old_items
          self._iter_data = new_iter_data
docs: Refresh the items of the pattern.
  
          This method destroys the old items and creates and initializes
          the new items.