UserSpace.remove_bases#

UserSpace.remove_bases(*bases)[source]#

Remove base spaces from inheritance hierarchy.

Removes one or more UserSpace objects from this space’s list of base spaces. After removal, cells and references that were inherited from these bases are deleted (unless inherited from other remaining bases, in which case their definitions are inherited from the remaining bases).

Parameters:

*bases – One or more UserSpace objects to remove from bases. Can be passed as individual arguments: remove_bases(base1, base2)

Example

>>> base1 = model.new_space('Base1')
>>> base1.new_cells('calc', lambda x: x * 2)

>>> derived = model.new_space('Derived')
>>> derived.add_bases(base1)
>>> derived.calc(5)
10

>>> derived.remove_bases(base1)
>>> derived.calc(5)  # No longer accessible
AttributeError: 'calc' not found

See also