estimator.Cost.reorder

Cost.reorder(first)[source]

Return a new ordered dict from the key:value pairs in dictinonary but reordered such that the first keys come first.

Parameters:
  • dictionary – input dictionary
  • first – keys which should come first (in order)

EXAMPLE:

sage: from estimator import Cost
sage: d = Cost([("a",1),("b",2),("c",3)]); d
a:        1
b:        2
c:        3

sage: d.reorder( ["b","c","a"])
b:        2
c:        3
a:        1