Think of the keystrokes that could be saved here, simply because Guido doesn't want to mix functional and imperative in lambdas???
Name:
Anonymous2008-08-23 7:30
Meh, I wonder why people often explain how Python's INDENT/DEDENT-based syntax is equivalent (and nicer to) braces-based syntax, yet they don't see how it's also equivalent in this case. Given a function f of a, b, c, where b can be a function:
f(1, lambda x:
statement... #INDENT token before this line
statement...
statement... #DEDENT token after this line
, 3)
Adding support for that to Python would be simple and so much better than the typical def _() a dozen lines above the actual call.
If Python's focus is readability, then I wonder why Guido hasn't realized this is much better, nicer and simpler than def _ in a separate statement.
In fact, my main gripe with Python is that it has statements - expressions' poor cousin, that are more limited than expressions just for the hell of it, and the Python devs seem obsessed to give you as much functional programming power and expressivity as a game demo, that goes "REGISTER NOW" whenever you get near the good stuff.
Examples: You have lambdas, but they are limited to an expression, and statements are crappier: you cannot use them in lambda. Functions are first-class values, but thus cannot define all of them anonymously because sometimes you require obnoxious statements in them. You have multiple assignment, but assignment is one of these obnoxious statements, unlike in C-like languages. You have lexical scoping, but you cannot rebind outer scope variables without defining them as nonlocal (in Py3K, currently not even that). You have if...else, but it works in a way it can't be sanely nested (Guido's cunning response to a functional if, I guess).
Crap, I need a statement-less Python. Everything else in Python is great, including what I consider my favourite object model.