On PEP 312: simple implicit lambda

Greg Ewing (using news.cis.dfn.de) me at privacy.net
Wed Feb 19 19:29:38 EST 2003


Stuart D. Gathman wrote:

> 	 if (btcb.flag & (BTCB.MWA | BTCB.MOV)) != 0:
> 	   btbuf(btcb.node,None)
> 	 elif (btcb.flag & BTCB.MOV) != 0 or when:
> 	   dispose()
> 	   btcb.abuf = node = getblk(btcb.node)
> 	 then btroot != btcb.root or btson > 0 or when:
> 	   r4 = btcount
> 	   if r4 == 0: raise EOFException
> 	   r7 = btcb.slot
>  	 then r7 <= 0 or r7 > r4 or when:
> 	   rc = chkkey()  # OK, this is artificial to mirror the ASM code
> 	 then rc:
> 	   bttrace(btcb.klen)


This is an... er... interesting idea, although I'm
not sure about the choice of the words "when" and
"then". I found I had to twist my brain somewhat to
get the above to read fluidly.

I had an idea of my own some time ago for a loop-
and-a-half construct which goes like this:

   while:
     <statements>
   gives <condition>:
     <more statements>

Maybe our ideas could be combined by substituting
"doing" and "gives" for your "when" and "then".
Your example would then become

   if (btcb.flag & (BTCB.MWA | BTCB.MOV)) != 0:
     btbuf(btcb.node,None)
   elif (btcb.flag & BTCB.MOV) != 0 or doing:
     dispose()
     btcb.abuf = node = getblk(btcb.node)
   gives btroot != btcb.root or btson > 0 or doing:
     r4 = btcount
     if r4 == 0: raise EOFException
     r7 = btcb.slot
   gives r7 <= 0 or r7 > r4 or doing:
     rc = chkkey()
   gives rc:
     bttrace(btcb.klen)

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list