No macros in Python

Patrick W patrickw106 at yahoo.com.au
Mon Dec 16 01:28:35 EST 2002


>Lulu of the Lotus-Eaters <mertz at gnosis.cx> writes:

(BTW, my aim is not to "defend" Lisp macros, or CLOS, or to argue that
Python should have a macro system, but to point out that macros (in
Lisp) are not just used for fancy control-flow constructs).

> [...] The idea that one would -need- to use macros to implement OOP
> sends shudders down my spine.  

To me, this sounds as strange and illogical as saying: "The idea that
one would -need- C to implement Python sends shudders down my spine."

Lisp is (largely) its own implementation language.  Python's
implementation language is C.  Object systems can be implemented by
hacking C/asm code deep in the bowels of an interpreter, or they can
be implemented in their native language.  If one of these two
approaches is "fragile" and "complex", my vote goes to the former.

(It doesn't matter whether you regard CLOS as a good OO system or not;
that's not the point.)

> Just as a "regular" programmer should not touch the macros that make up
> CLOS, a "regular" programmer should not touch the underlying Python
> interpreter.  

That's a fair argument I think.

> When regular programmers use macros, it is inevitably
> exactly as I stated:  to spell LOOP slightly differently 

No, "regular programmers" use macros for all kinds of stuff that has
nothing to do with loops.  Whether they *should* is a different
matter.  Without knowing what they're attempting, a simple yes or no
answer is only possible on religious grounds.  Your religion obviously
says "no".  Mine says "maybe ... what are you trying to do?"



More information about the Python-list mailing list