[Python-Dev] lambda in Python

2006-05-03 Thread xahlee
Today i ran into one of Guido van Rossum's blog article titled  
“Language Design Is Not Just Solving Puzzles” at
http://www.artima.com/weblogs/viewpost.jsp?thread=147358

The article reads very kooky. The bottom line is that Guido simply  
does not like the solution proposed for fixing the lambda construct  
in Python, and for whatever reasons thinks that no solution would  
satisfy him about this. But instead, he went thru sophistry on the  
ignorance and psychology of coder mass in the industry, with mentions  
of the mysterious Zen, the cool Google, the Right Brain, Rube  
Goldberg contraption irrelevancies.

 From his article, i noticed that there's largish thread of  
discussions on lambda.
The following is a essay i wrote after reading another one of Guido  
blog, in which shows prejudice and ignorance about functional  
programing. I hope it can reduce the ignorance about lambda and  
functional programing.

--
Lambda in Python 3000

Xah Lee, 20050930

On Guido van Rossum's website:
http://www.artima.com/weblogs/viewpost.jsp?thread=98196 (local copy)
dated 20050310, he muses with the idea that he would like to remove  
lambda, reduce(), filter() and map() constructs in a future version  
Python 3000.

Guido wrote:

 «filter(P, S) is almost always written clearer as [x for x in S  
if P(x)], and this has the huge advantage that the most common usages  
involve predicates that are comparisons, e.g. x==42, and defining a  
lambda for that just requires much more effort for the reader (plus  
the lambda is slower than the list comprehension)»

The form “[x for x in S if P(x)]” is certainly not more clear  
than “filter(P, S)”. The latter is clearly a function, what is the  
former? A function every programer in any language can understand and  
appreciate its form and function. Why would anyone to expect everyone  
to appreciate a Python syntactical idiosyncrasy “[x for ...]”?

Also, the argument that the form “filter(F,S)” being cumbersome  
because the first argument is a function and that mostly likely it  
would be a function that returns true/false thus most people will  
probably use the inline “lambda” construct and that is quite  
cumbersome than if the whole thing is written with the syntactical  
idiosyncrasy “[x for ...]”, is rather inane, as you can now see.

The filter(decision_function,list) form is clean, concise, and helps  
thinking. Why it helps thinking? Because it condenses the whole  
operation into its mathematical essence with the most clarity. That  
is, it filters, of a list, and by a yes/no decision function. Nothing  
is more, and nothing can be less. It is unfortunate that we have the  
jargon Lambda and Predicate developed by the tech geekers of the  
functional programing community. The lambda could be renamed Pure  
Function and the Predicate could be called True/False function, but  
the world of things being the way they are already, it is unwise to  
rewrite every existing Perl program just because somebody invented  
another language.

If the predicate P in filter(P,S) is cumbersome, so would exactly the  
same thing appear in the syntactical idiosyncrasy: “[x for x in S if  
P(x)]”.

Guido added this sting as a afterthought:

 «(plus the lambda is slower than the list comprehension)»

Which is faster is really the whim and capacity of Python compiler  
implementators. And, weren't we using clarity as the judgement a  
moment ago? The concept of a function every programer understands,  
but what the heck is a List Comprehension? Why don't you scrap list  
comprehension in Python 3000 and create a table() function that's  
simpler in syntax and more powerful in semantics? ( See http:// 
xahlee.org/perl-python/list_comprehension.html )

 «Why drop lambda? Most Python users are unfamiliar with Lisp or  
Scheme, so the name is confusing; also, there is a widespread  
misunderstanding that lambda can do things that a nested function  
can't -- I still recall Laura Creighton's Aha!-erlebnis after I  
showed her there was no difference! Even with a better name, I think  
having the two choices side-by-side just requires programmers to  
think about making a choice that's irrelevant for their program; not  
having the choice streamlines the thought process. Also, once map(),  
filter() and reduce() are gone, there aren't a whole lot of places  
where you really need to write very short local functions; Tkinter  
callbacks come to mind, but I find that more often than not the  
callbacks should be methods of some state-carrying object anyway (the  
exception being toy programs).»

In the outset Guido here assumes a moronitude about the set of Python  
users and what they are familiar of. Python users 10 years ago are  
not the same Python users today, and will certainly not be the same  
10 years later if you chop off lambda. Things change, math literacy  
advances, and what users you have changes with what you are. A  
function is the gist 

Re: [Python-Dev] lambda in Python

2006-05-04 Thread xahlee
I do not wish to be the subject of mobbing here.

If you have opinions on what i wrote, respond to the subject on topic  
as with any discussion. Please do not start a gazillion war-cry on me.

If you cannot tolerate the way i express my opinions, at this moment  
write a polite request to me and cc to the sys op of this forum. If  
the sysop deems fit, I'd be happy to be asked to leave by the sysop.

Thanks.

Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/


On 2006 May 4, at 6:21 AM, Jay Parlar wrote:


On May 4, 2006, at 6:00 AM, Talin wrote:

> xahlee  xahlee.org> writes:
>
>> Today i ran into one of Guido van Rossum's blog article titled
>> ?Language Design Is Not Just Solving Puzzles? at
>> http://www.artima.com/weblogs/viewpost.jsp?thread=147358
>
> The confrontational tone of this post makes it pretty much impossible
> to have a reasonable debate on the subject. I'd suggest that if you
> really want to be heard (instead of merely having that "I'm right"
> feeling) that you try a different approach.
>
> -- Talin

Xah Lee is a well known troll, he does stuff like this on c.l.p. all
the time. Best to just ignore him, he doesn't listen to reason.

Jay P.

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/xah% 
40xahlee.org


☄



___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] A critic of Guido's blog on Python's lambda

2006-05-05 Thread xahlee
In this post, i'd like to deconstruct one of Guido's recent blog  
about lambda in Python.

In Guido's blog written in 2006-02-10 at http://www.artima.com/ 
weblogs/viewpost.jsp?thread=147358

is first of all, the title “Language Design Is Not Just Solving  
Puzzles”. In the outset, and in between the lines, we are told  
that “I'm the supreme intellect, and I created Python”.

This seems impressive, except that the tech geekers due to their  
ignorance of sociology as well as lack of analytic abilities of the  
mathematician, do not know that creating a language is a act that  
requires little qualifications. However, creating a language that is  
used by a lot people takes considerable skill, and a big part of that  
skill is salesmanship. Guido seems to have done it well and seems to  
continue selling it well, where, he can put up a title of  
belittlement and get away with it too.

Gaudy title aside, let's look at the content of his say. If you  
peruse the 700 words, you'll find that it amounts to that Guido does  
not like the suggested lambda fix due to its multi-line nature, and  
says that he don't think there could possibly be any proposal he'll  
like. The reason? Not much! Zen is bantered about, mathematician's  
impractical ways is waved, undefinable qualities are given, human's  
right brain (neuroscience) is mentioned for support, Rube Goldberg  
contrivance phraseology is thrown, and coolness of Google Inc is  
reminded for the tech geekers (in juxtaposition of a big notice that  
Guido works there.).

If you are serious, doesn't this writing sounds bigger than its  
content? Look at the gorgeous ending: “This is also the reason why  
Python will never have continuations, and even why I'm uninterested  
in optimizing tail recursion. But that's for another installment.”.

This benevolent geeker is gonna give us another INSTALLMENT!

There is a computer language leader by the name of Larry Wall, who  
said that “The three chief virtues of a programmer are: Laziness,  
Impatience and Hubris” among quite a lot of other ingenious  
outpourings. It seems to me, the more i learn about Python and its  
leader, the more similarities i see.

So Guido, i understand that selling oneself is a inherent and  
necessary part of being a human animal. But i think the lesser beings  
should be educated enough to know that fact. So that when minions  
follow a leader, they have a clear understanding of why and what.



Regarding the lambda in Python situation... conceivably you are right  
that Python lambda is perhaps at best left as it is crippled, or even  
eliminated. However, this is what i want: I want Python literatures,  
and also in Wikipedia, to cease and desist stating that Python  
supports functional programing. (this is not necessarily a bad  
publicity) And, I want the Perl literatures to cease and desist  
saying they support OOP. But that's for another installment.

This post is archived at:
http://xahlee.org/UnixResource_dir/writ/python_lambda_guido.html

 Xah
 [EMAIL PROTECTED]
∑ http://xahlee.org/



☄




___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com