It looks like you changed "lambda" to "def" and added parentheses. It seems like that feature is already there...
Re:Code blocks in Python
by lucian1900 on Friday April 20, 2012 @09:34AM
(#3867783)
Perhaps my example was crap. They would also allow anything inside them.
Re:Code blocks in Python
by sirclueless on Friday April 20, 2012 @12:08PM
(#3868466)
The problem with multiline lambdas it that no one knows a good way to indent them. If they weren't butt-ugly python would probably already have them.
Re:Code blocks in Python
by stcredzero on Friday April 20, 2012 @01:37PM
(#3868926)
"The problem with multiline lambdas in Python is that no one knows a good way to indent them."
How about new keyword(s)? "begin" and "end"? I imagine this has thoroughly been discussed ad-nauseum. Is there a good synopsis?
Basically, there is no scope or block ending token anywhere else in python. And Guido thinks inline multi-line anonymous functions make programs harder to understand.
Re:Code blocks in Python
by lucian1900 on Friday April 20, 2012 @04:01PM
(#3869548)
I'm not sure it's that big a problem. CoffeeScript handles this pretty well using indentation.
CS has ambiguous cases because of optional ( ), but that wouldn't be the case with Python anyway.
But blocks? They're a misfeature of Ruby, badly copied from Smalltalk.
[edit: added "return"]