On 05/21/2015 05:28 PM, Greg Ewing wrote: > Ethan Furman wrote: >> >> I think the key difference is that the AST is not going to be >> converted to run different Python code under Python, but under >> some other language -- presumably to implement the semantics of >> the Python snippet. > > If the semantics were exactly the same as the Python > snippet, there would be no need to convert it to another > language -- you might as well just run the Python > code as-is. Going back to the OP: > Context: PonyORM (http://ponyorm.com/) allows you to write regular > Python generator expressions like this: > > 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. ;) -- ~Ethan~
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