[Python-ideas] Message passing syntax for objects

Benjamin Kaplan benjamin.kaplan at case.edu
Mon Mar 18 19:04:25 CET 2013

On Mon, Mar 18, 2013 at 10:18 AM, Mark Janssen
<dreamingforward at gmail.com> wrote:
>> Ian Cordasco wrote:
>>> On Sun, Mar 17, 2013 at 11:53 PM, Mark Janssen
>>> <dreamingforward at gmail.com> wrote:
>>>> Hello,
>>>> I just posted an answers on quora.com about OOP (http://qr.ae/TM1Vb)
>>>> and wanted to engage the python community on the subject.
>> My answer to that question would be that it *did*
>> catch on, it's just that we changed the terminology.
>> Instead of message passing, we talk about calling
>> methods.
> Yes, but this is where it breaks the OOP abstraction by 90 degrees.
> By using function calls, you're telling the machine to do something.
> But when you want to pass something to an object there should be a
> natural way to do this for every object.  By using methods you pollute
> the concept space with all sorts of semi-random (i.e. personal) names,
> like append, add, enqueue, etc.
> This proposal would not only make a consistent syntax across all
> objects, but train the programmer to *think* modularly in the sense of
> having a community of re-usable object.  I.e. "What should I do if
> another object passes me something?".  No one thinks this now, because
> the programmer expects new developers to learn *their* interface!
> Mark
> --

You're dreaming of a utopia where computers just read our minds and
know what we're thinking. So what if I can pass 42 into an object.
What do I intend to happen with that 42? Do I want to add the element
to a list? Access the 42nd element? Delete the 42nd element? Let the
object pick a behavior at random? Clearly there must be some sort of
behavior defined for passing a message into an object. And now we're
back to learning the interface that the programmer designed. Only now,
instead of having different types of behavior grouped together into
classes, we have to use a different object for each operation. So
what's the benefit of that over having the object implement the
__call__ method?

Also, why would we re-use the bit shift operators for message passing?
Just because C++ decided to overload the existing operators to mean
reading into and writing out of a stream doesn't mean it's a good

More information about the Python-list mailing list