[Python-ideas] Non-boolean return from __contains__

Chris Rebert pyideas at rebertia.com
Wed Jul 28 03:56:14 CEST 2010


On Tue, Jul 27, 2010 at 6:43 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
<snip>
> One of the things I would
> like to get from a code-as-ast feature is a natural way
> of embedding sub-expressions that *do* get evaluated
> according to the normal Python rules. For example,
> one should be able to write something like
>
>  cust = "SMITH"
>  date = today()
>  sales = select(transactions,
>    @ast: customer_code == cust and transaction_date == date)
>
> and have it possible for the implementation of select()
> to easily and safely evaluate 'cust' and 'date' in the
> calling environment.

In other words, you want (possibly an implicit form of) the comma
operator from Scheme's quasiquote.[1]
Maybe Paul Graham /was/ onto something.

Cheers,
Chris
--
[1] http://www.cs.hut.fi/Studies/T-93.210/schemetutorial/node7.html



More information about the Python-ideas mailing list