What's better about Ruby than Python?

Juha Autero Juha.Autero at iki.fi
Thu Aug 21 04:22:07 EDT 2003


Alex Martelli <aleax at aleax.it> writes:

> The counter-arguments you present in the following do not affect Mertz's
> argument in the least, and thus cannot indicate why you don't find it
> completely compelling.  To rephrase David's argument: simplicity suggests
> that a 'class' statement should always have the same fundamental semantics.
> Since it SOMETIMES needs to bind a name, therefore, letting it ALWAYS
> bind a name -- rather than sometimes yes, sometimes no, depending on
> context -- is the only Pythonic approach.

I think the problem here is same as with understanding Python
variables and assignment. People think names as objects themself
rather than bindings to an object. (Maybe I should have said "things"
to avoid confusin. Though in Python, everything you can bind a name to
is a Python object.) They think that after

class foo: pass

you get 

+-----+
| foo |
+-----+

but in Python in reality you get 
        +-----+
foo --> |     |
        +-----+

So, in Python all objects are basically anonymous. They just have
names bound to them. And since everything is an object, this goes for
classes and functions, too. I'm not sure about modules though. 

-- 
Juha Autero
http://www.iki.fi/jautero/
Eschew obscurity!






More information about the Python-list mailing list