[Python-ideas] Message passing syntax for objects

Nick Coghlan ncoghlan at gmail.com
Wed Mar 20 13:47:27 CET 2013


On Tue, Mar 19, 2013 at 9:36 PM, Mark Janssen <dreamingforward at gmail.com> wrote:
> I think I see the source of confusion, I used the word "object" when
> that is the term used in Python for lists, etc -- things used to store
> data, but I see them as separate.  I make a distinction between
> classes which not only may be stateful, but be able to *do* things,
> with data types which don't "do" things, but *are* things.  It's a
> subtle distinction, rather like languists distinguish between verbs
> and object even though both are *words*.

Python, however, makes no such distinction - everything is either an
object, or a reference to an object. Hence, the puzzled
incomprehension in response to your proposal.

In Python, even numbers can do things, like tell you how many bits an
integer needs for its binary representation:

>>> 3000 .bit_length()
12

Message passing is generally seen in the Python community as a higher
level state isolation technique, something you use to manage
increasing complexity, not something you use all the time. It's
similar to the way we allow people to use Python for imperative or
functional code, even though it's all object-oriented under the hood.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list