Revision d60946d9 lib/utils/algo.py

b/lib/utils/algo.py
148 148
  return dict(zip(dict_in.values(), dict_in.keys()))
149 149

  
150 150

  
151
def InsertAtPos(src, pos, other):
152
  """Inserts C{other} at given C{pos} into C{src}.
153

  
154
  @note: This function does not modify C{src} in place but returns a new copy
155

  
156
  @type src: list
157
  @param src: The source list in which we want insert elements
158
  @type pos: int
159
  @param pos: The position where we want to start insert C{other}
160
  @type other: list
161
  @param other: The other list to insert into C{src}
162
  @return: A copy of C{src} with C{other} inserted at C{pos}
163

  
164
  """
165
  new = src[:pos]
166
  new.extend(other)
167
  new.extend(src[pos:])
168

  
169
  return new
170

  
171

  
151 172
class RunningTimeout(object):
152 173
  """Class to calculate remaining timeout when doing several operations.
153 174

  

Also available in: Unified diff