A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-May/140092.html below:

[Python-Dev] Enable access to the AST for Python code

[Python-Dev] Enable access to the AST for Python code [Python-Dev] Enable access to the AST for Python codeGreg greg.ewing at canterbury.ac.nz
Fri May 22 04:06:54 CEST 2015
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

More information about the Python-Dev mailing list

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