[Python-Dev] Enable access to the AST for Python code
Ethan Furman
ethan at stoneleaf.us
Fri May 22 03:33:20 CEST 2015
More information about the Python-Dev mailing list
Fri May 22 03:33:20 CEST 2015
- Previous message (by thread): [Python-Dev] Enable access to the AST for Python code
- Next message (by thread): [Python-Dev] Enable access to the AST for Python code
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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~
- Previous message (by thread): [Python-Dev] Enable access to the AST for Python code
- Next message (by thread): [Python-Dev] Enable access to the AST for Python code
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list