jacopy.Rational

class jacopy.Rational(p, q=1)

Bases: Atom

A rational number p/q in lowest terms with q > 0.

Automatically collapses to Integer when the denominator is one after reduction.

Parameters:
__init__(p, q=1)
Parameters:

Methods

__init__(p[, q])

clone()

Return self.

find(predicate)

Yield descendants (including self) satisfying predicate.

replace_at(path, new)

Return a new tree with new spliced at path.

substitute_atom(dummy, target)

Return self with every occurrence of dummy replaced by target.

walk()

Pre-order traversal yielding self followed by descendants through children only.

Attributes

children

Tuple of immediate children.

is_atom

p

q