Python Macros

Jacek Generowicz jacek.generowicz at cern.ch
Wed Oct 6 03:07:42 EDT 2004


Andrew Dalke <adalke at mindspring.com> writes:

> Jacek Generowicz wrote:
> > _Most_ object-oriented languages support object orientation via the
> > message passing paradigm. Python included.
> 
> Translating the Smalltalk notation to Python -- what are
> the messages?  Is it that
> 
>    x.y(z)
> 
> means "send the __call__  (z)" message

instance(...) is syntactic sugar for instance.__call__(...) yes.

> to the result of the "z __getattr__ 'y'" message?

Yes, you could look at it that way, though it is not a particularly
helpful way of looking at it.

None of this takes away from the fact that the OO paradigm supported
by Python is called the message passing paradigm.

Some might argue that this is not the message passing paradigm, as (in
their opinion) the message passing paradigm mandates that _all_
interaction with the object be done via messages, and they might
(justifiably) argue that "x.y" is _not_ really a message.

But then, many would say that Python is not object-oriented at all, as
it does not have access restriction (enforced privacy).



More information about the Python-list mailing list