6.4.2.17. set_default_valueΒΆ

Dispatcher.set_default_value(data_id, value=empty, initial_dist=0.0)[source]

Set the default value of a data node in the dispatcher.

Parameters:
  • data_id (str) – Data node id.
  • value (T, optional) –

    Data node default value.

    Note

    If EMPTY the previous default value is removed.

  • initial_dist (float, int, optional) – Initial distance in the ArciDispatch algorithm when the data node default value is used.

***********************************************************************

Example:

A dispatcher with a data node named a:

>>> dsp = Dispatcher(name='Dispatcher')
...
>>> dsp.add_data(data_id='a')
'a'

Add a default value to a node:

>>> dsp.set_default_value('a', value='value of the data')
>>> list(sorted(dsp.default_values['a'].items()))
[('initial_dist', 0.0), ('value', 'value of the data')]

Remove the default value of a node:

>>> dsp.set_default_value('a', value=EMPTY)
>>> dsp.default_values
{}