Why is Python popular, while Lisp and Scheme aren't?

Brian Quinlan brian at sweetapp.com
Wed Nov 13 05:05:28 EST 2002


Martin wrote:
> You'll be wanting to throw out all manner of things on that basis,
since
> there's nothing of much use that hasn't been the source of problems
for
> some.  I know, you have to draw the line somewhere, but to me this
seems
> like a good deal of value to lose for what IME is little gain in
> idiot-proofing.  I can agree that the value seems to be lower in
Python in
> that the need for this arises less often than in, say, C.  I haven't
yet
> decided if I think that's due more to the language itself or to the
way
> the lack of operator= has led to the construction of facilities to 
> make it unnecessary for common uses.  :-/

The fact that VC++ and CW both generate warnings for inline assignment
(I don't know about gcc) leads me to suspect that it is a particularly
frequent source of problems.

> Think about the straightforward implementation of this in legal Python
> with less undersized indentation than I used before:

So you do not intend every block in other programming languages? I do...

> Yes, that approach occurred to me.  It seemed, and still seems, like a
> great deal of overhead and effort for little if any gain in clarity,
> although it certainly does solve the marching right off the 
> screen problem.

How are you measuring overhead? Lines of code? Performance? My technique
actually uses less lines of code as the number of record types
increases.

And if it required a lot of effort, I wouldn't have written the code for
this discussion :-) In total it probably took me 30 seconds to think of
the solution and 2 minutes to type it (mostly because my mail client
doesn't autoindent).
 
> > Notice that:
> > - it is very easy to add new record types
> 
> You have two things that have to be added for each new case: a regexp
and
> a code block.  

But I don't have to go looking through the file processing code to add
my regexp and code block. I just add it to a list.
 
> neither does the savings in explicit logic
> boilerplate appear to outweigh the function-form bolierplate it
requires.

They code size is identical in either case.

I don't really understand your complaint. My solution has a few
advantages over the inline assignment version and only costs you about
three lines of code. So it is really worth arguing for inline
assignment? I would say no, at least from looking at this example.

Cheers,
Brian





More information about the Python-list mailing list