Comment on PEP-0238

Tim Peters tim.one at home.com
Tue Jul 10 02:09:44 EDT 2001


[Tim]
>     print ``1`+`2``

[Thomas Wouters]
> Holy crap! I can't believe Python parses that correctly

[Greg Ewing]
> I think it works because if you see a ` when you're expecting
> the beginning of an expression it must be an opening-`, whereas
> if you see one just after you've seen a complete expression
> it must be a closing-`. Or something like that.

Close enough -- if the grammar production "testlist" could match whitespace,
it would be hosed.

> I was quite surprised[1] when I first saw it, too.

Note that, in the same spirit, we could save a character for other use by
writing that:

    I was quite surprised[1[ when I first saw it, too.

> [1] Or, in other words, horrified.

luckily-we-never-see-it-in-real-code-ly y'rs  - tim





More information about the Python-list mailing list