Python operator.__neg__() Examples

The following are 2 code examples of operator.__neg__(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module operator , or try the search function .
Example #1
Source File: balancer.py    From claripy with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def _align___sub__(self, a):
        cardinalities = [ self._cardinality(v) for v in a.args ]
        if max(cardinalities) == cardinalities[0]:
            return a

        adjusted = tuple(operator.__neg__(v) for v in a.args[1:]) + a.args[:1]
        return a.make_like('__add__', tuple(sorted(adjusted, key=lambda v: -self._cardinality(v))))

    #
    # Find bounds
    # 
Example #2
Source File: lineroot.py    From backtrader with GNU General Public License v3.0 5 votes vote down vote up
def __neg__(self):
        return self._operationown(operator.__neg__)