SQLAlchemy is a great example. For the uninitiated, SQLAlchemy is a ORM and uses Python expression to generate SQL statements. In a expression such as
meta.Session.query(model.Theme).filter(model.Theme.id == model.Vote.post_id)
the model.Theme.id == model.VoteWarn.post_id
does not return a boolean, but a object that eventually produces a SQL query like WHERE theme.id = vote.post_id
. The inverse would produce something like WHERE theme.id <> vote.post_id
so both methods need to be defined.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…