On 22/05/2015 1:33 p.m., Ethan Furman wrote: > Going back to the OP: > >> select(c for c in Customer if sum(c.orders.price) > 1000) >> >> which compile into and run SQL like this: >> >> SELECT "c"."id" >> FROM "Customer" "c" >> LEFT JOIN "Order" "order-1" ON "c"."id" = "order-1"."customer" >> GROUP BY "c"."id" >> HAVING coalesce(SUM("order-1"."total_price"), 0) > 1000 > > That last code is /not/ Python. ;) More importantly, it's not Python *semantics*. You can't view it as simply a translation of the Python expression into a different language. I still think this is really a macro facility by a different name. I'm not saying that's a bad thing, just pointing it out. The main difference is that a macro would (or at least could) be expanded at compile time, whereas this would require processing the AST each time it's used. -- Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4