icecube.icetray.pypick module¶
- class icecube.icetray.pypick.pypick(function)¶
Bases:
object
Construct lazily-evaluated boolean expressions from callables with identical signatures.
pypicks can be combined using the bitwise operators &, |, ~, and ^. The result e.g. of
pypick(a) | pypick(b)
is another pypick that, when called aspick(foo)
returns(a(foo) or b(foo))
.Examples
>>> p = pypick(lambda t: True) >>> q = pypick(lambda t: False) >>> (p&q)(None) False >>> (p|q)(None) True >>> (~p|q)(None) False >>> (p^q)(None) True >>> (p^~q)(None) False