cfdm.core.Container._del_component

Container._del_component(component, default=ValueError())[source]

Remove a component.

New in version (cfdm): 1.7.0

Parameters
component:

The name of the component to be removed.

default: optional

Return default if the component has not been set.

If set to an Exception instance then it will be raised instead.

Returns

The removed component. If unset then default is returned, if provided.

Examples

>>> f = cfdm.core.Container()
>>> f._set_component('foo', 'bar')
>>> f._has_component('foo')
True
>>> f._get_component('foo')
'bar'
>>> f._del_component('foo')
'bar'
>>> f._has_component('foo')
False