Lambda: the Ultimate Design Flaw

S

Scott David Daniels

Sunnan said:
...Because what is "boring"? The opposite of dense, tense, intense. Utterly
predictable; it's like the combination of all my prejudices. Even before
I knew, I thought "Bet Python separates statements from expressions".

Python is for terse, pithy prose; Python is not for poetry.

--Scott David Daniels
(e-mail address removed)
 
R

Ron_Adam

The danger in GOTO is that it allows the undisciplined programmer to
develop a badly-structured solution to a programming problem. A
disciplined programmer will write well-structured code with whatever
tools come to hand.

regards
Steve

And how that becomes really clear when you want to modify a large
program that uses GOTOs librally.


Ron
 
D

Donn Cave

Quoth Scott David Daniels <[email protected]>:
| Sunnan wrote:
| > ...Because what is "boring"? The opposite of dense, tense, intense. Utterly
| > predictable; it's like the combination of all my prejudices. Even before
| > I knew, I thought "Bet Python separates statements from expressions".
|
| Python is for terse, pithy prose; Python is not for poetry.

That's an odd thing to say. Poetry is verbose, florid?
Python is Dutch.

Donn
 
A

Aahz

[Aahz]

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code --
not in reams of trivial code that bores the reader to death." --GvR

It's just that I'm having a hard time matching that quote to what I
though python was about. I thought boring code was considered a virtue
in python. ("Explicit is better than implicit", "sparse is better than
dense".)

Because what is "boring"? The opposite of dense, tense, intense. Utterly
predictable; it's like the combination of all my prejudices. Even before
I knew, I thought "Bet Python separates statements from expressions".

Note very, VERY, *VERY* carefully that the quote says nothing about
"boring code". The quote explicitly refers to "reams of trivial code"
as boring -- and that's quite true. Consider this distinction:

if foo == 'red':
print 'foo is red'
elif foo == 'blue':
print 'foo is blue'

versus

print "foo is", foo

I'm sure you can think of many other examples -- real examples -- if you
put your mind to work; Guido's point is about the essential necessity of
refactoring and rewriting code for conciseness and clarity.
--
Aahz ([email protected]) <*> http://www.pythoncraft.com/

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code --
not in reams of trivial code that bores the reader to death." --GvR
 
S

Scott David Daniels

Donn said:
Quoth Scott David Daniels <[email protected]>:
| Sunnan wrote:
| > ...Because what is "boring"? The opposite of dense, tense, intense. Utterly
| > predictable; it's like the combination of all my prejudices. Even before
| > I knew, I thought "Bet Python separates statements from expressions".
|
| Python is for terse, pithy prose; Python is not for poetry.

That's an odd thing to say. Poetry is verbose, florid?

No, poetry is to be read slowly and carefully, appreciating the nuance
at every point. You should be able to read "past" python, while poetry
is at least as much about the form of the expression as it is about
what is being expressed.
 
A

Artie Gold

Torsten said:
Hallöchen!

Shriram Krishnamurthi has just announced the following elsewhere; it might
be of interest to c.l.s, c.l.f, and c.l.p:
http://list.cs.brown.edu/pipermail/plt-scheme/2005-April/008382.html


The Fate Of LAMBDA in PLT Scheme v300
or
Lambda the Ultimate Design Flaw

About 30 years ago, Scheme had FILTER and MAP courtesy of Lisp
hackers who missed them from their past experience. To this
collection, Scheme added a lexically-scoped, properly-functioning
LAMBDA. But, despite of the PR value of anything with Guy
Steele's name associated with it, we think these features should
be cut from PLT Scheme v300.

[...]


The whole text seems to be a variant of
<http://www.artima.com/weblogs/viewpost.jsp?thread=98196>.

Tschö,
Torsten.
Ya think? ;-)

--ag
 
A

alex goldman

Artie said:
Torsten said:
Hallöchen!

Shriram Krishnamurthi has just announced the following elsewhere; it
might be of interest to c.l.s, c.l.f, and c.l.p:
http://list.cs.brown.edu/pipermail/plt-scheme/2005-April/008382.html


The Fate Of LAMBDA in PLT Scheme v300
or
Lambda the Ultimate Design Flaw

About 30 years ago, Scheme had FILTER and MAP courtesy of Lisp
hackers who missed them from their past experience. To this
collection, Scheme added a lexically-scoped, properly-functioning
LAMBDA. But, despite of the PR value of anything with Guy
Steele's name associated with it, we think these features should
be cut from PLT Scheme v300.

[...]


The whole text seems to be a variant of
<http://www.artima.com/weblogs/viewpost.jsp?thread=98196>.

Tschö,
Torsten.
Ya think? ;-)

--ag

Wow, the original is much funnier than the "joke"! (Because it's meant
seriously)


"plus the lambda is slower than the list comprehension" - ROTFL!
 
S

Sunnan

Scott said:
No, poetry is to be read slowly and carefully, appreciating the nuance
at every point. You should be able to read "past" python, while poetry
is at least as much about the form of the expression as it is about
what is being expressed.

Right, I agree with these descriptions of python vs "the poetry
languages". I'm not sure whether I'd consider python particularly terse,
though, but I don't know enough about it yet. (I've read a couple of
programs but never started a project of my own in it, mainly because I
love poetry. I can see the appeal of a "prose language", though.)
 
S

Sunnan

Aahz said:
Note very, VERY, *VERY* carefully that the quote says nothing about
"boring code". The quote explicitly refers to "reams of trivial code"
as boring -- and that's quite true. Consider this distinction:

Thank you for this important clarification.
if foo == 'red':
print 'foo is red'
elif foo == 'blue':
print 'foo is blue'

versus

print "foo is", foo

Is the space added automatically? (Like awk does, if you add a comma.)
I'm sure you can think of many other examples -- real examples -- if you
put your mind to work; Guido's point is about the essential necessity of
refactoring and rewriting code for conciseness and clarity.

Which is a good point to make in almost any language, for code that is
to be maintained.

Sunnan
 
S

Steve Holden

Scott said:
Python is for terse, pithy prose; Python is not for poetry.

--Scott David Daniels
(e-mail address removed)

I though that too, until Michael Spencer sent me the following
executable Python limerick, which I declared the PyCon limerick
competition and read as a part of my closing address:

# Freely re-distributable under Poetic License*
# Voice only the alphanumeric tokens

from itertools import repeat
for feet in [3,3,2,2,3]:
print " ".join("DA-DA-DUM"
for dummy in [None]
for foot in repeat("metric", feet))

*thanks to Peter Hansen

regards
Steve
 
W

Warren Postma

Donn said:
That's an odd thing to say. Poetry is verbose, florid?
Python is Dutch.

Ha. I'm vaguely dutch, whatever that means.

I would say if there is a sister word for "Programming" in the english
language, it isn't Poetry and it surely isn't Prose. It's Dialectic.
I appreciate the idea of "Code Poetry", and I find more than a few
coders out there with more than a rudimentary appreciation of Poetry as
well, but I don't like the analogy. No slight to Poetry is intended.
Rather, I intend it as a compliment. Code has an almost entirely
practical purpose, Malbol et al excluded. Poetry, except in cases of
extraordinarily bad poetry, may have little "practical" purpose.

Now dialectic. I like that word. And I think the art of programming is
somewhere in the Late-Medeival period right now. From Merriam Webster,
meanings 1,5,6 seem rather sympathetic to texts used in the creation of
software:

Dialectic

1. LOGIC
5. Any systematic reasoning, exposition, or argument that juxtaposes
opposed or contradictory ideas and usually seeks to resolve their
conflict/an intellectual exchange of ideas
6 : the dialectical tension or opposition between two interacting forces
or elements

One way to look at Code is as a textual abstraction of a design. Having
been flattened from brain-space into a two dimension matrix of latin
glyphs, certain semantic/meta-data is typically omitted. Thus a
classical programming problem in many languages: The "Write-only-code"
syndrom. You wrote it, it runs, but you're afraid even to touch it
yourself. Python is stronger than other languages I have used. When I
go back to Python code I've written long enough ago to have forgotten
everything about, I am more able to pick it up and work with it than I
am with other less agile languages. I'm not merely talking about
pedantic details of literal code-readability, I'm talking about the
ability to intuit design from implementation, and the orthogonality of
the design of the system to the to the faculty of human reason. (In not
so many words: Python fits my brain.)

Warren
 
S

Steve Holden

Scott said:
Python is for terse, pithy prose; Python is not for poetry.

--Scott David Daniels
(e-mail address removed)

I though that too, until Michael Spencer sent me the following
executable Python limerick, which I declared the PyCon limerick
competition and read as a part of my closing address:

# Freely re-distributable under Poetic License*
# Voice only the alphanumeric tokens

from itertools import repeat
for feet in [3,3,2,2,3]:
print " ".join("DA-DA-DUM"
for dummy in [None]
for foot in repeat("metric", feet))

*thanks to Peter Hansen

regards
Steve
 
T

T.D. Lassagne

Heh. I was glad that Torsten pointed it out; I didn't get what was funny
about the joke until then.

Please consider joining the International Sarcasm Society. Our motto is
"Like We Need YOUR Support".
 
S

Sunnan

T.D. Lassagne said:
Please consider joining the International Sarcasm Society. Our motto is
"Like We Need YOUR Support".

I *recognize* sarcasm; I just don't think it's very funny. Now parody,
which this turned out to be, I can appreciate.
 
A

Aahz

[Aahz]
Mind providing evidence rather than simply citing your feelings?

The important word was "honest", not "feeling". :)

Fair enough.
And when will that be? The principle of "there is only way to do it"
was observable in Python 1.5.2, and started to disappear at that time.
How many years between 1.5.2 and 3.0?


Many of us are using Python today, week after week, year long. So
let's be pragmatic. Python is what it became and now is. Let's not
define it as a memory from the past nor as a futuristic dream.

You're free to continue using 1.5.2. Why don't you? Because you want
shiny new features only available in current releases. To maintain true
"only one way", existing features would need to be removed -- but that
would break backward compatibility. Given the tension of the various
requirements, I think that Python has broken "only one way" as little as
possible, with the full intention of getting closer to its ideal when the
time comes to break backward compatibility.

You just can't have your cake and eat it, too.
--
Aahz ([email protected]) <*> http://www.pythoncraft.com/

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code --
not in reams of trivial code that bores the reader to death." --GvR
 
I

Ivan Van Laningham

Hi All--
Given the tension of the various
requirements, I think that Python has broken "only one way" as little as
possible, with the full intention of getting closer to its ideal when the
time comes to break backward compatibility.

I wrote my mayalib package under 1.3.0. It still runs perfectly well.
I will only have to rewrite parts of it when the string module goes
away. Everything else works, and will continue to work for the
forseeable future.

That's actually less change than happened with C over the same time
period. But there, the language didn't change, just the environment
around it--includes, libs, where things lived, etc.

Metta,
Ivan
----------------------------------------------
Ivan Van Laningham
God N Locomotive Works
http://www.andi-holmes.com/
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps: Cu Chi, Class of '70
Author: Teach Yourself Python in 24 Hours
 
V

Ville Vainio

Sunnan> It's just that I'm having a hard time matching that quote
Sunnan> to what I though python was about. I thought boring code
Sunnan> was considered a virtue in python. ("Explicit is better
Sunnan> than implicit", "sparse is better than dense".)

Boring code is code that numbs your senses with constant flow of
boilerplate crap, memory management and redundant type declarations
and general blah blah that you skip when you are trying to figure out
what a piece of code does. It's a code that you wish you could train a
monkey to write for you while you go for lunch. Think C++ or Java.
 
V

Ville Vainio

Sunnan> languages". I'm not sure whether I'd consider python
Sunnan> particularly terse, though, but I don't know enough about
Sunnan> it yet. (I've read a

Read up on list comprehensions and generator expressions. You'll see
the terse side of Python (and genexps look kinda poetic too ;-).
 
S

Sunnan

Ville said:
Read up on list comprehensions and generator expressions. You'll see
the terse side of Python (and genexps look kinda poetic too ;-).

I am familiar with lc:s/genexps, I usually program in scheme which also
has them (srfi-42).
They're very nice and I use them a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top