proposed syntax for multiline anony-functions (hopefully?)

icefapper at gmail.com icefapper at gmail.com
Thu Aug 21 03:55:55 EDT 2014


Hi, just wanting to do a shot in the dark,but maybe this syntax is Pythonic (in a "we-are-all-grown-ups" fashion, ahem)enough to get its way into the language
this is what yours truly thinks: don't we all know that ":" means the next token must be an indent (mostly)? and doesn't the "(" and its alikes, [ and } begin an space-insensitive lexing context? so all we need is having an "space-sensitivity-stack" and the corresponding "(" counting stack and this way we could match opening and closing "()" and pop the space-sensitivity-stack whenever the "(" counting stack gets a 0 at the top:

def doFunc(func): return func()
doFunc(def(): 
   print( "anon" )
   return "gvr") #this ")" will try to decrease the "(" -matching stak's top, but this is a zero(there is no "(" to be matchd in the current context) so this will pop the "(" stack and also the space sensitivity stack till a non-zero value gets in top of "("-matching stac


 



More information about the Python-list mailing list