Ticket 16211 - add comparison operators to F() expressions #405

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
4 participants
Member

akaariai commented Sep 28, 2012

Allow use of ==, !=, <=, <, >, >= and ~ operators in F() expression comparisons.

The only problematic case here is the override of eq which will break using F() expressions in dicts or sets, and of course comparing two F() expressions should be done with 'f1 is f2 ' instead of 'f1 == f2'.

Pull create for easier review.

Member

alex commented Sep 28, 2012

I'm pretty sure there's no good reason to put an F() obj into a set or dict, so I wouldn't lose sleep over it.

Member

claudep commented Sep 28, 2012

Does anything prevent you from redefining hash ?

Member

alex commented Sep 28, 2012

You don't want to have an hash with an eq that returns non-boolean results.

Member

akaariai commented Sep 28, 2012

Seems like the options are to not ever support comparison operators for F() expressions, or just push this in. I am in favour of merging this even if this creates an uneasy feeling.

Contributor

wdoekes commented Sep 28, 2012

Works for me ;)

Contributor

wdoekes commented Sep 28, 2012

Oh, and thanks for picking this up!

Member

akaariai commented Sep 30, 2012

Pushed in manually in ddd7d1a, 28abf5f and c253282

akaariai closed this Sep 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment