Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How would you model string comparisons with LIKE?


For those you would have a method on the field object (e.g., `Table.field.like("whatever")`).


Yeah, but that's different from the operator. It's a different way of thinking about it. Maybe that's the reason they used dou le underscores for everything, to keep it consistent.


Not really. Both method calls and operators are consistent with how Python normally works. Outside of Django you never do `obj__op(value)` or `obj__meth(value)` to do the equivalent of `obj op value` or `obj.meth(value)`. It is Django that is inconsistent with how operations are done in Python.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: