[Python-ideas] Message passing syntax for objects
Mark Janssen
dreamingforward at gmail.com
Wed Mar 20 05:20:57 CET 2013
On Tue, Mar 19, 2013 at 7:49 AM, Nick Coghlan <ncoghlan at gmail.com> 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)".
Cheeky comments aside, the problem with this is that it conflates to
fundamental, very different desires: execute and pass-this-message.
While yes in my mind I can think of obj.method(data) as passing data
to my object, *I don't want to do it in my mind*. I want to do it in
the interpreter. That's a big difference, because *other programmers
can't read my mind* and THEY won't know if I'm passing data or
executing a function.
Mark
More information about the Python-ideas
mailing list