# HG changeset patch # User Paul Boddie # Date 1367432032 -7200 # Node ID 70a49534216f9f1695649243c295c49b86c5318c # Parent 3374d92c9cff5ac64123f3cdd26196ed518c7511 Added missing operator functions. diff -r 3374d92c9cff -r 70a49534216f lib/operator.py --- a/lib/operator.py Wed May 01 19:39:46 2013 +0200 +++ b/lib/operator.py Wed May 01 20:13:52 2013 +0200 @@ -3,7 +3,7 @@ """ Operator support. -Copyright (C) 2010 Paul Boddie +Copyright (C) 2010, 2013 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -121,6 +121,9 @@ def and_(a, b): return binary_op(a, b, lambda a: a.__and__, lambda b: b.__rand__) +def contains(a, b): + return b in a + def div(a, b): return binary_op(a, b, lambda a: a.__div__, lambda b: b.__rdiv__) @@ -159,6 +162,9 @@ def neg(a): return unary_op(a, lambda a: a.__neg__) +def not_(a): + return not a + def pos(a): return unary_op(a, lambda a: a.__pos__)