1.1 --- a/lib/operator.py Wed May 01 19:39:46 2013 +0200
1.2 +++ b/lib/operator.py Wed May 01 20:13:52 2013 +0200
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Operator support.
1.6
1.7 -Copyright (C) 2010 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2010, 2013 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -121,6 +121,9 @@
1.13 def and_(a, b):
1.14 return binary_op(a, b, lambda a: a.__and__, lambda b: b.__rand__)
1.15
1.16 +def contains(a, b):
1.17 + return b in a
1.18 +
1.19 def div(a, b):
1.20 return binary_op(a, b, lambda a: a.__div__, lambda b: b.__rdiv__)
1.21
1.22 @@ -159,6 +162,9 @@
1.23 def neg(a):
1.24 return unary_op(a, lambda a: a.__neg__)
1.25
1.26 +def not_(a):
1.27 + return not a
1.28 +
1.29 def pos(a):
1.30 return unary_op(a, lambda a: a.__pos__)
1.31