I really like the style of this. I remember seeing LINQ years ago and wondering if something like it was possible in Python. I was disappointed when it looked like it couldn't be done, but generating an AST then translating to SQL is smart.
It seems from this thread not many people appreciate the parity of:
list(o for o in Item if o.price>3)
when Item is a normal in-memory Python iterable, and:
select(o for o in Item if o.price>3)
when Item is a row in a database.
After just helping someone get started that was new to Python and Django, it was weird helping them learn list comprehensions and generators and then having to teach such a divergent form of syntax to work with the Django ORM even though the a lot of the concepts should be similar.
It seems from this thread not many people appreciate the parity of:
when Item is a normal in-memory Python iterable, and: when Item is a row in a database.After just helping someone get started that was new to Python and Django, it was weird helping them learn list comprehensions and generators and then having to teach such a divergent form of syntax to work with the Django ORM even though the a lot of the concepts should be similar.