[OPINION] - does language really matter if they all do the samething?

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Thu Feb 12 03:28:39 CET 2004

Dietrich Epp wrote:
> Python seems to take the middle ground.  ... 
 > It's not what I'd choose as an example of an object oriented
> language.  There are no messages, only function calls, so you can't 
> capture them.

What do you mean by a "message"? If you're talking about a
Smalltalk method selector, the Python equivalent of that
is simply the name of the method, as a string. You can do
all the same things with that in Python as you can do with
a method selector in Smalltalk (testing whether the method
exists, etc.)

> the paradigm of sending a message "to" an object 
> doesn't exist, 
But "sending a message" is just the terminology Smalltalkers
happen to use to refer to the act of calling a method. What
actually happens is extremely similar to what happens in
Python. Sending a message in Smalltalk involves two
conceptual steps:

(1) Look up the message selector in the class to find a
piece of code.

(2) Call the code, passing it the arguments of the message.

In Python, the analogous steps are:

(1) Look up the name of the method in the class, yielding
a callable object.

(2) Call the callable object, passing it the arguments of
the method call.

The main difference is that in Python the intermediate
result between (1) and (2) is a tangible object that you
can manipulate, whereas in Smalltalk looking up the method
and calling it are done together indivisibly.

 > and anyone coming from Smalltalk or even Objective-C
 > might miss that and feel constrained (I did).

How did you feel constrained? If you tell us what Smalltalk-like
thing you wanted to do but couldn't, maybe we can help you find
a Pythonic equivalent. Underneath the surface syntax, Python
and Smalltalk are very similar in many ways.

Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand

More information about the Python-list mailing list