Python's "only one way to do it" philosophy isn't good?

Paul Rubin http
Mon Jun 25 08:12:31 CEST 2007

Douglas Alan <doug at> writes:
> And likewise, good macro programming can solve some problems that no
> amount of linting could ever solve.

I think Lisp is more needful of macros than other languages, because
its underlying primitives are too, well, primitive.  You have to write
all the abstractions yourself.  Python has built-in abstractions for a
few container types like lists and dicts, and now a new and more
general one (iterators), so it's the next level up.  Haskell abstracts
the concept of containers to something called monads, so operations
like loops and list comprehensions fall out automatically (it took me
a while to realize that--Haskell listcomps weren't a bright new idea
someone thought of adding to an otherwise complete language: they were
already inherently present in the list monad operations and their
current syntax is just minor sugaring and is actually restricted on
purpose to make the error messages less confusing).

So, a bunch of stuff one needs macros to do conveniently in Lisp, can
be done with Python's built-in syntax.  And a bunch of stuff that
Python could use macros for, are easily done in Haskell using delayed
evaluation and monads.  And Haskell is starting to grow its own macro
system (templates) but that's probably a sign that an even higher
level language (maybe with dependent types or something) would make
the templates unnecessary.

More information about the Python-list mailing list