<div><h4id="userdefinedfunctionscannotbevaluessotheymustbewrapped">User-defined functions cannot be values, so they must be wrapped:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> functools <spanclass="hljs-keyword">import</span> partial
<div><h4id="userdefinedfunctionscannotbevaluessotheymustbewrapped">User-defined functions cannot be values, so they must be wrapped:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> functools <spanclass="hljs-keyword">import</span> partial
LogicOp = Enum(<spanclass="hljs-string">'LogicOp'</span>, {<spanclass="hljs-string">'AND'</span>: partial(<spanclass="hljs-keyword">lambda</span> l, r: l <spanclass="hljs-keyword">and</span> r),
<spanclass="hljs-string">'OR'</span> : partial(<spanclass="hljs-keyword">lambda</span> l, r: l <spanclass="hljs-keyword">or</span> r)})