Re: proposed syntax for multiline anony-functions (hopefully?)
On Thursday, August 21, 2014 2:27:08 AM UTC-7, Marko Rauhamaa wrote: > In practice, your proposal would not make life easier for Python > > programmers. > > > > > > Marko neither did the lambda, yours truly supposes? -- https://mail.python.org/mailman/listinfo/python-list
Re: proposed syntax for multiline anony-functions (hopefully?)
> tag_handler = { > > "span": lambda content: content, > > "div": lambda content: "\n"+content+"\n", > > "p": lambda content: "\n"+content+"\n", > > "br": lambda content: "\n", > > } > > > > If you wanted to expand one of those to have statements in it, you'd > > have to take it out-of-line and break the flow. what 'bout, well , this? tag_handler = { "span": lambda content: content, "div": lambda content: "\n"+content+"\n", "p": lambda content: "\n"+content+"\n", "br": lambda content: "\n", } yours truly is trying to convey the actual fact that python could already be untidy; what has kept the language tidy so far is partly because moral developers (the syntax being another half) yours truly will hence think the proposition won't be directly untidifying the syntax -- much in the sense that not-caring-for-ws-in-"{" won't. -- https://mail.python.org/mailman/listinfo/python-list
Re: proposed syntax for multiline anony-functions (hopefully?)
it is simply a matter of convenience: def a(): print( "gvr" ) func(a); or func( def(): print("gvr") ) it would be great if others could further share their opinions -- https://mail.python.org/mailman/listinfo/python-list
Re: proposed syntax for multiline anony-functions (hopefully?)
reasonable, but I don't like the close parens on the same line; even > > if this syntax is allowed, I'd frown on it in style guides, > thanks, bu what exactly do you find unlikeable in this syntax? the ")" is no new syntax, but simply a match for a previous "("; and you can put it anywhere because the "(" contents are space-insensitive: this would be a syntax error: a = def(): print("gvr") this too: a = def(): print("anon") but not this: a = (def(): print("no") ) neither this: a = (def(): print("d")) nor this: a = (def(): print( "no" ) ) we're all grown-ups, aren't we? if we wanted to mess the syntax up then "(" alone would have let us do obscene things like: if (a == b): gvr() or a =(1, 2 5 ) and we also could fiddle with an instance's (or class's) intendedly private members (no pun) but did we ever do? yours truly would be glad to know your thoughts on this -- https://mail.python.org/mailman/listinfo/python-list
Re: proposed syntax for multiline anony-functions (hopefully?)
> reasonable, but I don't like the close parens on the same line; even > > if this syntax is allowed, I'd frown on it in style guides, > thanks, bu what exactly do you find unlikeable in this syntax? the ")" is no new syntax, but simply a match for a previous "("; and you can put it anywhere because the "(" contents are space-insensitive: this would be a syntax error: a = def(): print("gvr") this too: a = def(): print("anon") but not this: a = (def(): print("no") ) neither this: a = (def(): print("d")) nor this: a = (def(): print( "no" ) ) yours truly would be glad to know your thoughts on this -- https://mail.python.org/mailman/listinfo/python-list
proposed syntax for multiline anony-functions (hopefully?)
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 -- https://mail.python.org/mailman/listinfo/python-list