Python, Lambda, and Guido van Rossum
Xah Lee, 2006-05-05
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/viewpo...?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 is
mentioned for support (neuroscience!) , 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/w...bda_guido.html
* * Xah
* * xa*@xahlee.org
∑ http://xahlee.org/
May 6 '06
267 10843
Ken Tilton <ke*******@gmai l.com> wrote:
... Why? (symbol-name '|(|) -> "(" (No, the "s are not part of the name!)
If you want to argue about that, I will have to bring up the Lisp readtable. Or did you forget that, too?
Mea culpa -- it wasn't in the Lisp(s) I used 25+ years ago, nor in
Scheme; I've never used Common Lisp in anger, and obviously "just
dabbling" gives one no good feel for how *INSANELY COMPLICATED* (or, if
you prefer, "insanely extensible") it truly is.
I personally think these gyrations are a good example of why Python, the
language that "fits your brain" and has simplicity among its goals, is
vastly superior for production purposes. Nevertheless, I admit I was
wrong!
Alex al*****@yahoo.c om (Alex Martelli) writes: Bill Atkins <NO**********@r pi.edu> wrote: ... Believe it or not, _you_ got it wrong. Acknowledged: Common Lisp is even MORE insane (note that the quote "INSANELY extensible" is from Tilton) than I believed -- I'm pretty sure that the Lisp dialects I used in 1979-1981 didn't go to such crazy extremes, and neither did Scheme.
Buh? The project doesn't have to be late for Brooks's law to hold; adding programmers, so goes Brooks reasoning, will always increase the time required to complete the project because of various communication issues.
And here is where we check if you're as gracious about admitting your errors, as I am about mine. Brooks' law is:
"""Adding manpower to a late software project makes it later."""
These are Brooks' words, literally. OK so far?
You are correct.
I posted too hastily. Here is what my paragraph ought to have said:
Buh? The project doesn't have to be late for Brooks's law to hold;
adding programmers *in the middle of a project*, so goes Brooks
reasoning, will always increase the time required to complete the
project because of various communication issues.
Agree?
Your claim, that adding programmers will ALWAYS increase the time, is not just wrong, but utterly ridiculous. I can't put it better than the wikipedia: """ Misconceptions
A commonly understood implication of Brooks' law is that it will be more productive to employ a smaller number of very talented (and highly paid) programmers on a project than to employ a larger number of less talented programmers, since individual programmer productivity can vary greatly between highly talented and efficient programmers and less talented programmers. However, Brooks' law does not mean that starving a project of resources by employing fewer programmers beyond a certain point will get it done faster. """
Moreover, check out the research on Pair Programming: it scientifically, empirically confirms that "two heads are better than one", which should surprise nobody. Does this mean that there aren't "various communication issues"? Of course there are, but there's no implied weighting of these factors wrt the _advantages_ of having that second person on the team (check the Pair Programming literature for long lists of those advantages).
Only empirical research can tell us where the boundary is -- when productivity is decreased by going from N to N+1. A lot depends on imponderable issues such as personality meshes or clashes, leadership abilities at hands, methodology used, etc. All of this is pretty obvious, making your assertion that Brooks held otherwise actionable (as libel, by Brooks) in many legislations.
Hahaha.
As it happens, I also have examples in which adding (a few carefully selected) people to a software project that WAS (slightly) late put that project back on track and made it deliver successfully on schedule. Definitely not the "pointy-haired boss" management style of "throwing warm bodies at the problem" that Brooks was fighting against, but, consider: the project's velocity has suffered because [a] the tech lead has his personal (usually phenomenal) productivity hampered by a painful condition requiring elective surgery to abate, and [b] nobody on the team is really super-experienced in the intricacies of cryptography, yes some very subtle cryptographic work turns out to be necessary. One day, the tech lead calls in -- the pain has gotten just too bad, he's going for surgery, and will be out of the fray for at least one week.
I still remember with admiration how my Director reacted to the emergency: he suspended two other projects, deciding that, if THEIR deadlines were broken, that would be a lesser damage to the company than if this one slipped any further; and cherrypicked exactly two people -- one incredibly flexible "jack of all trades" was tasked with getting up to speed on the project and becoming the acting TL for it, and an excellent cryptography specialist was tasked to dig deep into the project's cryptography needs and solve them pronto.
So, We Broke Brooks' Law -- the cryptographer did his magic, and meanwhile the JOAT ramped up instantly and took the lead (kudos to the Jack's skills, to the clarity and transparency of the previous TL's work, to the agile methodologies employed throughout, AND to the uniformity of style of one language which will stay unnamed here)... and the project delivered on time and within budget. We had one extra person (two "replacemen ts" for one TL's absence), yet it didn't make the late software project even later -- it brought it back on track perfectly well.
I have many other experiences where _I_ was that JOAT (and slightly fewer ones where I was the specialist -- broadly speaking, I'm more of a generalist, but, as needs drive, sometimes I do of necessity become the specialist in some obscure yet necessary technology... must have happened a dozen times over the 30 years of my careers, counting graduate school...).
This set of experiences in no way tarnishes the value of Brooks' Law, but it does *put it into perspective*: done JUST RIGHT, by sufficiently brilliant management, adding A FEW people with exactly the right mix of skills and personality to a late software project CAN save the bacon,
Fair enough. But what does Python offer above any garbage-collected language that makes it so scalable?
Uniformity of style, facilitating egoless programming; a strong cultural bias for simplicity and clarity, and against cleverness and obscurity; "just the right constraints" (well, mostly;-), such as immutability at more or less the right spots (FP languages, with _everything_ immutable, have an edge there IN THEORY... but in practice, using them most effectively requires a rare mindset/skillset, making it hard to "scale up" teams due to the extra difficulty of finding the right people).
Alex
--
This is a song that took me ten years to live and two years to write.
- Bob Dylan
"Xah Lee" <xa*@xahlee.org > writes: In this post, i'd like to deconstruct one of Guido's recent blog about lambda in Python.
Why couldn't you keep this to comp.lang.pytho n where it would almost
be relevant? Before I pulled down the headers, I thought maybe
something interesting was posted to comp.lang.lisp.
Followups set.
-- http://www.david-steuber.com/
1998 Subaru Impreza Outback Sport
2006 Honda 599 Hornet (CB600F) x 2 Crash & Slider
It's OK. You only broke your leg in three places. Walk it off.
Alex Martelli wrote: Ken Tilton <ke*******@gmai l.com> wrote: ...
Why? (symbol-name '|(|) -> "(" (No, the "s are not part of the name!)
If you want to argue about that, I will have to bring up the Lisp readtable. Or did you forget that, too?
Mea culpa -- it wasn't in the Lisp(s) I used 25+ years ago, nor in Scheme; I've never used Common Lisp in anger, and obviously "just dabbling" gives one no good feel for how *INSANELY COMPLICATED* (or, if you prefer, "insanely extensible") it truly is.
I personally think these gyrations...
Please. You are the only one gyrating. I was joking with both |(| and
the fact that its length is one, no matter what our eyes tell us.
And I hope to god you were joking with the objection that a Lisper could
not name a variable "(". You would not say something that daft just to
win a Usenet debate, would you? Omigod...I think you did! I mean, look
at the way you were jumping up and down and shouting and accusing Bill
and me of not understanding English and... well, you are an uber tech
geek, what did i expect? All is forgiven. But...
It is vastly more disappointing that an alleged tech genius would sniff
at the chance to take undeserved credit for PyCells, something probably
better than a similar project on which Adobe (your superiors at
software, right?) has bet the ranch. This is the Grail, dude, Brooks's
long lost Silver Bullet. And you want to pass?????
C'mon, Alex, I just want you as co-mentor for your star quality. Of
course you won't have to do a thing, just identify for me a True Python
Geek and she and I will take it from there.
Here's the link in case you lost it: http://www.lispnyc.org/wiki.clp?page=PyCells
:)
peace, kenny
ps. flaming aside, PyCells really would be amazingly good for Python.
And so Google. (Now your job is on the line. <g>) k
--
Cells: http://common-lisp.net/project/cells/
"Have you ever been in a relationship?"
Attorney for Mary Winkler, confessed killer of her
minister husband, when asked if the couple had
marital problems.
Alex Martelli wrote: ``An unneeded feature "cannot" be added (elegantly) in future releases of the language'' is just as trivial and acceptable for the unneded feature ``allow ( as an ordinary single-character identifier'' as for the unneded feature ``allow unnamed functions with all the flexibility of named ones''.
You can't be seriously claiming that these two features are equally
(un)needed. Anonymous functions come from the foundations of computer
science - Lamda Calculus. They are just a natural step on the road to
higher level languages. There are useful programming techniques, like
monadic programming, that are infeasible without anonymous functions.
Anonymous functions really add some power to the language.
On the other hand, what do you get by allowing ( as an indentifier?
Significant whitespace is a good thing, but the way it is designed in
Python it has some costs. Can't you simply acknowledge that?
Best regards
Tomasz
Bill Atkins <NO**********@r pi.edu> wrote:
... And here is where we check if you're as gracious about admitting your errors, as I am about mine. Brooks' law is:
"""Adding manpower to a late software project makes it later."""
These are Brooks' words, literally. OK so far?
You are correct.
I posted too hastily. Here is what my paragraph ought to have said:
Buh? The project doesn't have to be late for Brooks's law to hold; adding programmers *in the middle of a project*, so goes Brooks reasoning, will always increase the time required to complete the project because of various communication issues.
Agree?
"What does one do when an essential software project is behind schedule?
Add manpower, naturally. As Figs 2.1 through 2.4 suggest, this may or
may not help".
How do you translate "may or may not help" into "will always increase
the time required", and manage to impute that translation to "Brooks
reasoning"? It *MAY* help -- Brooks says so very explicitly, and from
the Fig 2.4 he quotes just as explicitly you may infer he has in mind
that the cases in which it may help are those in which the project was
badly understaffed to begin with (a very common case, as the rest of the
early parts of chapter 2 explains quite adequately).
I could further critique Brooks for his ignoring specific personal
factors -- some extremely rare guys are able to get up to speed on an
existing project in less time, and requiring less time from those
already on board, than 99.9% of the human race (the JOAT in my previous
example); and, another crucial issue is that sometimes the key reason a
project is late is due to lack of skill on some crucial _specialty_, in
which case, while adding more "generic" programmers "may or may not
help" (in Brooks' words), adding just the right specialist (such as, the
cryptography expert in my previous example) can help a LOT. But, it
would be uncourteous to critique a seminal work in the field for not
anticipating such detailed, nuanced discussion (besides, in the next
chapter Brooks does mention teams including specialists, although if I
recall correctly he does not touch on the issue of a project which finds
out the need for a specialist _late_, as in this case). I'm still more
interested in critiquing your overgeneralizat ion of Brooks' assertions
and reasoning.
Alex
Alex Martelli wrote: Having to give functions a name places no "ceiling on expressiveness" , any more than, say, having to give _macros_ a name.
And what about having to give numbers a name?
Yes, we are, because the debate about why it's better for Python (as a language used in real-world production systems, *SCALABLE* to extremely large-scale ones) to *NOT* be insanely extensible and mutable is a separate one -- Python's uniformity of style allows SCALABILITY of teams, and teams-of-teams
I think this kind of language scalability is most important for Google,
see below.
if your need SCALE, well then, PYTHON IS SCALABLE, and will remain a *SIMPLE, CLEAN, LITTLE AND POWERFUL LANGUAGE* (letting nobody do anything INSANE to it;-) while scaling up to whatever size of project(s) you need (including systems so large...
But honestly, isn't this scalability a result of the data processing
model you use, which is language independent? My point is that when you
have such a well scaling data processing model, most languages scale
well on the "data" and "load" axes, so you pick your language based on
how well it scales on the "teams" and "features" axes.
You seem to claim that there is something in Python that lets it scale
well on "data" and "load", and is not related to "teams" and "features",
and also not related to Google's data processing model. Can you tell
me what it is?
Best regards
Tomasz
Ken Tilton wrote: It is vastly more disappointing that an alleged tech genius would sniff at the chance to take undeserved credit for PyCells, something probably better than a similar project on which Adobe (your superiors at software, right?) has bet the ranch. This is the Grail, dude, Brooks's long lost Silver Bullet. And you want to pass?????
Looking at the description, Cells looks a lot like one of our internal Python
libraries at Enthought. It's quite useful. Not worldchanging, not a silver
bullet, but useful.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
Tomasz Zielonka <to************ *@gmail.com> wrote: Alex Martelli wrote: Having to give functions a name places no "ceiling on expressiveness" , any more than, say, having to give _macros_ a name. And what about having to give numbers a name?
Excellent style, in most cases; I believe most sensible coding guides
recommend it for most numbers -- cfr
<http://en.wikipedia.or g/wiki/Magic_number_(p rogramming)> , section
"magic numbers in code". Yes, we are, because the debate about why it's better for Python (as a language used in real-world production systems, *SCALABLE* to extremely large-scale ones) to *NOT* be insanely extensible and mutable is a separate one -- Python's uniformity of style allows SCALABILITY of teams, and teams-of-teams
I think this kind of language scalability is most important for Google, see below.
It's definitely very important for Google, just as for most organization
doing software development on a large scale. if your need SCALE, well then, PYTHON IS SCALABLE, and will remain a *SIMPLE, CLEAN, LITTLE AND POWERFUL LANGUAGE* (letting nobody do anything INSANE to it;-) while scaling up to whatever size of project(s) you need (including systems so large...
But honestly, isn't this scalability a result of the data processing model you use, which is language independent? My point is that when you have such a well scaling data processing model, most languages scale well on the "data" and "load" axes, so you pick your language based on how well it scales on the "teams" and "features" axes.
There's one more axis, the "size of software project" one (in some unit
of measure such as function points). That is partly related to
"language level", but it's not _just_ about that -- e.g., Ruby's
language level is basically the same as Python, but (in my modest
experience) it doesn't scale up quite as well to very large software
projects, as it's more prone to subtle coupling between modules (as it
makes it easy for one module to affect others indirectly, by making
modifications to fundamental globals such as "Object" and other built-in
types).
You seem to claim that there is something in Python that lets it scale well on "data" and "load", and is not related to "teams" and "features", and also not related to Google's data processing model. Can you tell me what it is?
I don't think that (apart from whatever infrastructure Google may have
developed, and partly published in various whitepapers while partly
deciding to not discuss it publically) Python's scaling on "data" and
"load", to use your terminology, should be intrinsically different
(i.e., due to language differences) from that of other languages with
similar characteristics , such as, say, Ruby or Smalltalk.
Alex
Tomasz Zielonka <to************ *@gmail.com> wrote:
... higher level languages. There are useful programming techniques, like monadic programming, that are infeasible without anonymous functions. Anonymous functions really add some power to the language.
Can you give me one example that would be feasible with anonymous
functions, but is made infeasible by the need to give names to
functions? In Python, specifically, extended with whatever fake syntax
you favour for producing unnamed functions?
I cannot conceive of one. Wherever within a statement I could write the
expression
lambda <args>: body
I can *ALWAYS* obtain the identical effect by picking an otherwise
locally unused identifier X, writing the statement
def X(<args>): body
and using, as the expression, identifier X instead of the lambda.
On the other hand, what do you get by allowing ( as an indentifier?
Nothing useful -- the parallel is exact.
Significant whitespace is a good thing, but the way it is designed in Python it has some costs. Can't you simply acknowledge that?
I would have no problem "acknowledg ing" problems if I agreed that any
exist, but I do not agree that any exist. Please put your coding where
your mouth is, and show me ONE example that would be feasible in a
Python enriched by unlimited unnamed functions but is not feasible just
because Python requires naming such "unlimited" functions.
Alex This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tom Anderson |
last post by:
Comrades,
During our current discussion of the fate of functional constructs in
python, someone brought up Guido's bull on the matter:
http://www.artima.com/weblogs/viewpost.jsp?thread=98196
He says he's going to dispose of map, filter, reduce and lambda. He's
going to give us product, any and all, though, which is nice of him.
|
by: Mike Meyer |
last post by:
I know, lambda bashing (and defending) in the group is one of the most
popular ways to avoid writing code. However, while staring at some Oz
code, I noticed a feature that would seem to make both groups happy -
if we can figure out how to avoid the ugly syntax.
This proposal does away with the well-known/obscure "lambda"
keyword. It gives those who want a more functional lambda what they
want. It doesn't add any new keywords. It doesn't...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |