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 2:17
ONE WORD: FORCED PURITY OF LAMBDAS
Name:
Anonymous2008-08-23 2:26
according to my calculations, that's four words. that's not very pythonistic
Name:
Anonymous2008-08-23 7:29
Lambda's can only contain a single expression, but assignment is a statement not an expression.
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.
Name:
Anonymous2008-08-23 7:49
Python is stupid because of all that Guido's "benevolent dictator for life" crap. He likes to have "only one way to do" everything, which is why there will be no tail recursion, lambdas are discriminated, and at one point he even planned to remove the higher-order functions.
Also, >>5, with additions like this, wouldn't Python become a poor man's Lisp/Scheme? Just use the real deal, at least it's faster. And you'll have macros.
Name:
Anonymous2008-08-23 7:56
>>6
Scheme doesn't have a built-in object system as good as Python's, nor infix syntax, and most of all, Scheme doesn't have Python's standard and third party library.
>>6
I wonder if feature creep is a good idea. I always thought that higher order functionality in Python is all the bloat that should exist in Python and there shouldn't be any more.
If you really wanted truly powerful techniques in a tightly designed and yet elegant manner, you should use the right tool: Haskell.
Name:
Anonymous2008-08-23 21:45
>>1
One word, self.fig_can.mpl_connect('button_press_event', lambda event: setattr(self, cur_axes, event.inaxes)), thread over.
Name:
Anonymous2010-12-17 1:20
Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?
If you answered "Yes" to all of the above questions, then GNAA(GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!