[Python-ideas] Non-boolean return from __contains__

Robert Kern robert.kern at gmail.com
Tue Jul 27 18:25:11 CEST 2010

On 7/27/10 9:02 AM, Guido van Rossum wrote:

> Therefore I think the LINQ approach, which (IIUC) converts an
> expression into a parse tree when certain syntax is encountered, and
> calls a built-in method with that parse tree, would be a fresh breath
> of air. No need deriding it just because Microsoft came up with it
> first.

I've occasionally wished that we could repurpose backticks for expression literals:

   expr = `x + y*z`
   assert isinstance(expr, ast.Expression)

And triple backticks for blocks of statements:

   block = ```
except FrobError:
     print("Not on my watch!")
   assert isinstance(block, ast.Module)

Too bad backticks look like grit on Tim's monitor!

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Python-ideas mailing list