Python Macros

has has.temp2 at virgin.net
Tue Oct 5 10:13:48 CEST 2004


Arich Chanachai <macrocosm at fastmail.fm> wrote in message news:<mailman.4261.1096912338.5135.python-list at python.org>...

> Not sure I understand you here.  I want to implement messages like in 
> ObjC where if you send a msg to an object and that object does know what 
> to do with it, it can send the obj automatically to another object which 
> might know what to do with it.

You can implement this behaviour using Python's magic __getattr__
method and getattr function to request an attribute from another
object. See:

http://www.python.org/doc/2.3.4/ref/attribute-access.html

For real macros, you'll have to go to Lisp or Lisp derivatives such as
Dylan. The rest of the programming world is still catching up to 1958.
:p



More information about the Python-list mailing list