get_precedence_lhs
- sherpa.models.op.get_precedence_lhs(lstr: str, lp: int, p: int, a: bool) str [source] [edit on github]
Return the string to use for the left 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 lstr or (lstr).
- Return type:
Examples
>>> get_precedence_lhs("a", NO_PRECEDENCE, lprec[np.divide], False) 'a'
>>> get_precedence_lhs("a + b", lprec[np.add], lprec[np.divide], False) '(a + b)'
>>> get_precedence_lhs("a * b", lprec[np.multiply], lprec[np.add], False) 'a * b'