DynamicSpace.precedents(*args, **kwargs)#

Return a list of the precedents.

This is a method of Cells and Space types, and returns a list of Node objects that are precedents of the object’s node specified by the arguments passed to the method.

The preds() method is similar to this method, but preds() only lists nodes of Cells and Spaces. This method also lists nodes of Reference values in addition to the nodes of Cells and Spaces returned by preds().

import modelx as mx

space = mx.new_space()

space.x = 1
space.Child.y = 2
space.Child.GrandChild.z = 3

def foo(t):
    return t

def bar(t):
    return foo(t) + x + Child.y + Child.GrandChild.z

The bar Cells depends on one Cells foo, and 3 References, x, Child.y, and Child.GrandChild.z. Below, bar.preds(3) returns a list containing foo(3), which is the only Cells element that bar(3) depends on:

>>> bar(3)

>>> bar.preds(3)

The precedents() method returns a list containing not only Cells elements, but also References that bar(3) depends on when calculating its value:

>>> bar.precedents(3)

References whose values are modelx objects, such as Cells and Spaces, are not included in the lists returned by this method.

See also

preds(), succs(), node()

New in version 0.15.0.