| Home | Trees | Indices | Help |
|
|---|
|
|
A dictionary with attribute-style access,
that maps attribute access to the real dictionary.
Interactive example:
>>> m = ParameterDict(Re = 1.0, f = "sin(x)")
>>> print m
Re = 1.0
f = 'sin(x)'
>>> s = ParameterDict(max_iterations = 10, tolerance = 1e-8)
>>> print s
max_iterations = 10
tolerance = 1e-08
>>> p = ParameterDict(model = m, solver = s)
>>> print p
model = {
Re = 1.0
f = 'sin(x)'
}
solver = {
max_iterations = 10
tolerance = 1e-08
}
>>> q = p.copy()
>>> q.model.Re = 2.3e6
>>> q.solver.max_iterations = 100
>>> print q
model = {
Re = 2300000.0
f = 'sin(x)'
}
solver = {
max_iterations = 100
tolerance = 1e-08
}
>>> print p
model = {
Re = 1.0
f = 'sin(x)'
}
solver = {
max_iterations = 10
tolerance = 1e-08
}
>>> p.update(q)
>>> print p
model = {
Re = 2300000.0
f = 'sin(x)'
}
solver = {
max_iterations = 100
tolerance = 1e-08
}
>>> s.nothere = 123
Traceback (most recent call last):
File "doctest.py", line 1212, in __run
compileflags, 1) in test.globs
File "<doctest __main__.ParameterDict[13]>", line 1, in <module>
s.nothere = 123
File "ParameterDict.py", line 107, in __setattr__
raise AttributeError("%s is not an item in this parameter dict." % key)
AttributeError: nothere is not an item in this parameter dict.
|
|||
new empty dictionary |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
| a shallow copy of D |
|
||
| None |
|
||
|
Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
x.__init__(...) initializes x; see help(type(x)) for signature
|
str(x)
|
repr(x)
|
del x[y]
|
x.__setattr__('name', value) <==> x.name = value
|
Make a copy of self, including recursive copying of parameter subsets. Parameter values themselves are not copied.
|
A recursive update that handles parameter subsets correctly unlike dict.update.
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Thu Jan 31 03:52:23 2013 | http://epydoc.sourceforge.net |