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

2015-05-21 Thread Greg
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 B

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

2015-05-21 Thread Ethan Furman
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 wer

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

2015-05-21 Thread Ben Hoyt
FYI, I've re-posted this on python-ideas now: https://mail.python.org/pipermail/python-ideas/2015-May/033621.html -Ben On Wed, May 20, 2015 at 10:31 PM, Guido van Rossum wrote: > Hey Ben, this is probably a better topic for python-ideas. I'll warn you > that a hurdle for ideas like this is that

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

2015-05-21 Thread Steve Dower
ainly not an unreasonable request. Cheers, Steve Top-posted from my Windows Phone From: Greg Ewing<mailto:greg.ew...@canterbury.ac.nz> Sent: ‎5/‎21/‎2015 17:29 To: python-dev@python.org<mailto:python-dev@python.org> Subject: Re: [Python-Dev] Enable acce

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

2015-05-21 Thread Peter Ludemann via Python-Dev
On 21 May 2015 at 17:12, Ethan Furman wrote: > On 05/21/2015 04:33 PM, Greg Ewing wrote: > >> Steve Dower wrote: >> >>> >>> It's only a macro system when you generate code in unexpected/unobvious >>> places with it. This is more like inspect.getsource(), but going straight >>> to the AST. >>> >>

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

2015-05-21 Thread Greg Ewing
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, the

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

2015-05-21 Thread Ethan Furman
On 05/21/2015 04:33 PM, Greg Ewing wrote: Steve Dower wrote: It's only a macro system when you generate code in unexpected/unobvious places with it. This is more like inspect.getsource(), but going straight to the AST. Is it really that much different? The end result is the same -- the user

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

2015-05-21 Thread Greg Ewing
Steve Dower wrote: It's only a macro system when you generate code in unexpected/unobvious places with it. This is more like inspect.getsource(), but going straight to the AST. Is it really that much different? The end result is the same -- the user writes something that looks like a Python ex

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

2015-05-21 Thread Ben Hoyt
Heh, thanks. :-) On Thu, May 21, 2015 at 2:17 PM, Guido van Rossum wrote: > Dang it. :-) I just want to encourage you to continue pursuing this idea, > one way or another. > > On Thu, May 21, 2015 at 7:01 AM, Ben Hoyt wrote: > >> Thanks. Good point about python-ideas -- I was thinking that afte

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

2015-05-21 Thread Guido van Rossum
Dang it. :-) I just want to encourage you to continue pursuing this idea, one way or another. On Thu, May 21, 2015 at 7:01 AM, Ben Hoyt wrote: > Thanks. Good point about python-ideas -- I was thinking that after I sent > it too. I'll repost there soon. > > Out of interest, what specifically were

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

2015-05-21 Thread Ben Hoyt
Thanks. Good point about python-ideas -- I was thinking that after I sent it too. I'll repost there soon. Out of interest, what specifically were you referring to as "definitely cool" here: LINQ-style generator expressions that build SQL ala PonyORM, or the more general feature of enabling AST acc

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

2015-05-21 Thread Steve Dower
nz> Sent: ‎5/‎20/‎2015 22:33 To: Python-Dev<mailto:python-dev@python.org> Subject: Re: [Python-Dev] Enable access to the AST for Python code Guido van Rossum wrote: > Hey Ben, this is probably a better topic for python-ideas. I'll warn you > that a hurdle for ideas like this is

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

2015-05-20 Thread Greg Ewing
Guido van Rossum wrote: Hey Ben, this is probably a better topic for python-ideas. I'll warn you that a hurdle for ideas like this is that ideally you don't want to support this just for CPython. It's definitely cool though! This would effectively be a macro system. I thought your position on

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

2015-05-20 Thread Nick Coghlan
On 21 May 2015 at 12:31, Guido van Rossum wrote: > Hey Ben, this is probably a better topic for python-ideas. I'll warn you > that a hurdle for ideas like this is that ideally you don't want to support > this just for CPython. It's definitely cool though! (Using movie poster > style quotes you can

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

2015-05-20 Thread Guido van Rossum
Hey Ben, this is probably a better topic for python-ideas. I'll warn you that a hurdle for ideas like this is that ideally you don't want to support this just for CPython. It's definitely cool though! (Using movie poster style quotes you can turn this into a ringing endorsement: "definitely cool" -