logoalt Hacker News

BrenBarntoday at 8:26 AM3 repliesview on HN

The Django filter syntax with the double underscores is like fingernails on a chalkboard to me. I find it insane that they didn't just use operator overloading to create a real query expression language.


Replies

mixmastamyktoday at 9:09 PM

I think you can do that with querysets, Q, and F. The kwargs are a limited convenience.

ezsttoday at 9:03 AM

Or now that python has ~types, this is really an area where things could be improved. Filtering would just be lambda predicate with fields auto complete as seen in .NET, scala, etc

7bittoday at 10:10 AM

There may be many reason other than rejecting that suggestion leading to what it is know. Your statement somehow suggests that it was deliberately decided against what you propose. I don't think we know that.

I can't quite picture how operator overloading would look like, could you give an example?

show 2 replies