CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
diclist.diclist Class Reference
Inheritance diagram for diclist.diclist:

Public Member Functions

def __getitem__ (self, index)
 
def __init__ (self)
 
def __setitem__ (self, index, value)
 
def add (self, key, value)
 

Public Attributes

 dico
 

Detailed Description

list with an internal dictionary for indexing, 
allowing to keep dictionary elements ordered. 
keys can be everything except an integer.

Definition at line 4 of file diclist.py.

Constructor & Destructor Documentation

◆ __init__()

def diclist.diclist.__init__ (   self)

Definition at line 10 of file diclist.py.

10  def __init__(self):
11  super( diclist, self).__init__()
12  # internal dictionary, will contain key -> index in list
13  self.dico = {}
14 

Member Function Documentation

◆ __getitem__()

def diclist.diclist.__getitem__ (   self,
  index 
)
index can be a dictionary key, or an integer specifying
the rank of the value to be accessed

Definition at line 23 of file diclist.py.

23  def __getitem__(self, index):
24  '''index can be a dictionary key, or an integer specifying
25  the rank of the value to be accessed
26  '''
27  try:
28  # if index is an integer (the rank), use the list.
29  return super(diclist, self).__getitem__(index)
30  except (TypeError, ValueError):
31  # else it's the dictionary key.
32  # use the internal dictionary to get the index,
33  # and return the corresponding value from the list
34  return super(diclist, self).__getitem__( self.dico[index] )
35 

References diclist.diclist.dico.

◆ __setitem__()

def diclist.diclist.__setitem__ (   self,
  index,
  value 
)
These functions are quite risky...

Definition at line 36 of file diclist.py.

36  def __setitem__(self, index, value):
37  '''These functions are quite risky...'''
38  try:
39  return super(diclist, self).__setitem__(index, value)
40  except TypeError as ValueError:
41  return super(diclist, self).__setitem__( self.dico[index], value )
42 
43 
44 

References diclist.diclist.dico.

◆ add()

def diclist.diclist.add (   self,
  key,
  value 
)

Member Data Documentation

◆ dico

diclist.diclist.dico
PVValHelper::add
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
Definition: PVValidationHelpers.cc:12
format