Comment on PEP-0238

Greg Ewing greg at cosc.canterbury.ac.nz
Tue Jul 10 05:29:59 CEST 2001


Thomas Wouters wrote:
> 
> On Sat, Jul 07, 2001 at 06:13:33PM -0400, Tim Peters wrote:
> 
> >     print ``1`+`2``
> 
> Holy crap! I can't believe Python parses that correctly

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.

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

[1] Or, in other words, horrified.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list