What's better about Ruby than Python?

Jacek Generowicz jacek.generowicz at cern.ch
Fri Aug 22 10:12:05 EDT 2003


Hans Nowak <hans at zephyrfalcon.org> writes:

> Jacek Generowicz wrote:
> 
> [re-binding __builtins__ considered harmful]
> 
> I see your point.  The obvious answer would be "so don't do that,
> then".  Of course, the same answer would apply to writing abusive
> macros.

Exactly.

> Python usually strikes a good balance between being permissive and
> restrictive.

In your opinion. The opinions of others, as to where a "good balance"
lies, will be different. And that's just fine. That's why we have
different languages.

I happen to agree that Python strikes a good balance. I also think
that Common Lisp strikes a good balance. The position of "good
balance" is a function of the language's audeince.

> > Just because a stupid or malicious programmer could do "bad things" is
> > not a reason to reduce a language's power. (You end up with Java.)
> 
> You are right, but one could wonder if the drawbacks don't outweight
> the benefits.  Python is already powerful as it is (compared to
> languages other than Lisp ;-).  I'm not sure if powerful macros would
> do much good.

Well, with an interactive language[*] you can easily get two types of
programmers: the providers, and the users. A good macro facility
allows the provider types to create very useful abstractions for the
user types. The user types can use those abstractions without having
the faintest clue that they are built using macros, and can happily
program in the language without ever writing one of their own. (A bit
like metaclasses.)

Just because there are macros or metaclasses in a language, does not
mean that everyone needs to know about them, while everyone can
benefit from them.

[*] I guess that this is not exclusive to interactive languages, but I
    suspect it's more marked.

But, wrt macros in Python, I don't really see what Python macros would
look like. Lisp code is represented in a fundamental, hierarchical,
easily transformable built-in data type. This ain't true for Python.

Sometimes I think "if Python had Lisp-like macros, what I am trying to
achieve right now would be so much easier". This doesn't mean that I
would necessarily advocate the inclusion of macros in Python. What I
object to, is the suggestion (which has been made repeatedly around
the thread) that macros are evil and should be avoided, and that
macros are responsible for the fragmentation/death of Lisp.

Macros are great. If a good, Pythonic macro system could be invented,
I am sure that it could be put to great use, and that it would not
engender the death of Python. I am not sure that such a system can be
invented. I do not suggest that such a system _should_ be added to
Python.




More information about the Python-list mailing list