On 19 Oct 2009, at 16:39 , Oleg Broytman wrote:
On Mon, Oct 19, 2009 at 10:28:58PM +0800, starwing wrote:
Oleg Broytman ??????:
Single-line lambdas are good enough, and if you need more - just create a named function.
BUT, why we need a name? just to process something or make decide, sometimes code itself is enough.
A multiline function is certainly not a simple piece of code; it requires documentation - docstring, comments - and the name is a part of the documentation.
Why would grouping two statements require such an overhead? Do you write a comment for each line of Python code you produce? A function, named or not, is nothing more than a bloc of code (in fact that's exactly how they're called in Smalltalk), and not all blocs of code require a name, a docstring and comments.