macro FAQ

John J. Lee jjl at pobox.com
Sat Aug 23 12:20:23 EDT 2003


"Andrew Dalke" <adalke at mindspring.com> writes:

> Here's a proposed Q&A for the FAQ based on a couple recent
> threads.  Appropriate comments appreciated
[...]
> Those against including macros in Python point out that
> Python has a different focus.  It has a broad target audience.
> Beginners can pick it up pretty easily yet advanced
> developers also enjoy working in the language.  New features,
> like new builtin functions, additional core types, expanding
> the standard libraries, list comprensions, metaclasses and
> deriving from object, and macros, all make it harder to
> learn how to use Python well and shifts the balance more
> towards advanced programmers.
> 
> More importantly, the detractors -- including those
> with plenty of experience using macros in Lisp -- argue that
> macros cause dialects to form.  Macros can modify other code to
> make it fit the problem better, while functions only use other
> code but make no modifications.  This makes them very
> powerful but means that understanding a section of code
> requires also knowing about any macros which might use the
> code.  In an extreme case which wouldn't be used in real
> projects, every * could be replaced with a +.
[...]

About the first paragraph here: I don't recall anyone arguing that,
but maybe I forget.  Anyway, my problem with it is that it reinforces
the "Python is a scripting language for amateurs, not suitable for
large scale / systems programming" attitude.  I think Python
demonstrates that there isn't much tension in reality between the
'advanced programmers' and the beginners -- both seem to want a simple
language.  And as you say, the argument about dialects is more
important anyway.

Other than that, excellent stuff.


John




More information about the Python-list mailing list