[Python-ideas] Message passing syntax for objects

Ethan Furman ethan at stoneleaf.us
Tue Mar 19 16:33:34 CET 2013

On 03/19/2013 07:49 AM, Nick Coghlan wrote:
> On Mon, Mar 18, 2013 at 11:28 PM, Chris Angelico <rosuav at gmail.com> wrote:
>> There are interfaces where a generic "do something with X and Y"
>> concept makes sense, but I don't think program code is one of them.
> Having finally parsed out what I think the OP is asking for, I have to
> disagree. In fact, Guido disagrees as well: he thinks what the OP
> wants is so important that he built it into Python from day one.
> The notation Python uses to "send a message" to an object is actually
> "obj(message)".

I don't disagree with you, Nick, but I don't think that's what the OP is
looking for, either.  Even using call syntax, it seems to me the OP would still
only be sending one type of message, with no arguments, no differentiation,
no choices.

To use the OP's own example:


would add 42 to the collection... but we have no say in where, or how.  In fact,
using call() notation we have less than the OP's proposal as his proposal has a
one-way in and a one-way out, but an argument-less* call can only provide one of
those two options.


*By argument-less I mean we can only give one thing to call.

More information about the Python-ideas mailing list