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

maney at pobox.com maney at pobox.com
Wed Nov 13 19:51:53 EST 2002


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

Of course I do.  But in other languages I don't seem to have so much trouble
with pointless blocks/indentation required to work around a limitation of
the language.  Other annoyances, yes, but not, usually, this one.

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

That wasn't how I counted it in your sketch, given the need to def separate
functions for every action separate from the pattern/action table.  But that
wasn't really what I was measuring (estimating, more precisely).  I was
weighing the cost of obscuring, if only a bit, the very simple and obvious
alternation structure, along with the need to code and debug a small but
non-trivial loop (and I have some experience with how weird the errors can
be when something like this goes haywire - though Python's traceback would
probably help a good deal IFF the error caused a fault immediately when it
occurred).  A pinch of concern for the need to reinvent the mental model
when someone else, or even myself sufficently much later, has to revisit it
was surely in the mix.

> 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).

Oh, I agree.  Without, admittedly, typing it, I envisioned the whole thing
in the blink of an eye... well, a slow wink, maybe.  Then I spent the rest
of perhaps a minute fleshing it out beyond the handwaving stage and decided
against it.  Truly, I have done logic-into-data transformations many times
over the years; they're one of my favorite hacks (partly because so many
folks aren't familiar with the style).  Possibly I overestimate the cost of
doing this in Python - I've only been using it for serious work since early
this year - but as I have used the technique in Python a few times
previously, I doubt it's too large an error.

> I don't really understand your complaint.

See above.  The table-driven solution is indirect and thus less obvious, at
least at the scale of this problem.  As I have said perhaps half a dozen
times now in varous branches of the thread, I would be much more favorably
inclined towards it if the pattern/action sets were larger, and more in need
of an organizing principle.




More information about the Python-list mailing list