pg.Diff

Accessible via pg.Diff, pg.symbolic.Diff.

class Diff(left=MISSING, right=MISSING, children={})[source]

Bases: pg.PureSymbolic, pg.Object

A value diff between two objects: a ‘left’ object and a ‘right’ object.

If one of them is missing, it may be represented by pg.Diff.MISSING

For example:

>>> pg.Diff(3.14, 1.618)
Diff(left=3.14, right=1.618)
>>> pg.Diff('hello world', pg.Diff.MISSING)
Diff(left='hello world', right=MISSING)

Methods:

format([compact, verbose, root_indent])

Override format to conditionally print the shared value or the diff.

sym_eq(other)

Override symbolic equality.

Attributes:

is_leaf

Returns True if current Diff does not contain inner Diff object.

value

Returns the value if left and right are the same.

format(compact=False, verbose=True, root_indent=0, **kwargs)[source]

Override format to conditionally print the shared value or the diff.

property is_leaf: bool[source]

Returns True if current Diff does not contain inner Diff object.

sym_eq(other)[source]

Override symbolic equality.

property value[source]

Returns the value if left and right are the same.