Passing expressions to functions?

前端 未结 6 521

I\'m not quite sure what I mean here, so please bear with me..

In SQLAlchemy, it appears I\'m supposed to pass an expression to filter() in certain cases. When I try to

6条回答
  •  耶瑟儿~
    2021-02-01 20:26

    It appears you can return tuples from eq:

    class Foo:
        def __init__(self, value):
                self.value = value
    
        def __eq__(self, other):
                return (self.value, other.value)
    
    
    f1 = Foo(5)
    f2 = Foo(10)
    print(f1 == f2)
    

提交回复
热议问题