[Python-ideas] Non-boolean return from __contains__
Masklinn
masklinn at masklinn.net
Tue Jul 27 18:42:32 CEST 2010
On 2010-07-27, at 18:25 , Robert Kern wrote:
> 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 = ```
> try:
> frobnicate()
> except FrobError:
> print("Not on my watch!")
> ```
> assert isinstance(block, ast.Module)
>
> Too bad backticks look like grit on Tim's monitor!
What about french quotes
expr = «x + y * z»
block = «««
try:
frobnicate()
except FrobError:
print("Oh no you di'n't")
»»»
?
Or maybe some question marks?
expr = ¿x + y * z?
More information about the Python-ideas
mailing list