get_precedence_rhs
- sherpa.models.op.get_precedence_rhs(rstr: str, opstr: str, rp: int, p: int) str [source] [edit on github]
Return the string to use for the right side of a binary operator.
This is only needed when the operator (represented by the p value) is written in infix form - such as ‘a + b’- rather than prefix form like ‘np.add(a, b)’.
- Parameters:
- Returns:
term – Either rstr or (rstr).
- Return type:
Examples
>>> get_precedence_rhs("a", "/", NO_PRECEDENCE, lprec[np.divide]) 'a'
>>> get_precedence_rhs("a + b", "/", lprec[np.add], lprec[np.divide]) '(a + b)'