Python Macros

gabriele renzi rff_rff at remove-yahoo.it
Wed Oct 6 12:23:58 CEST 2004


Alex Martelli ha scritto:

> 
> Please explain how this syntax choice "discriminates" anything
> whatsoever?  __getattr__ is called when some message isn't understood by
> the "normal" mechanisms of the object, too.

I actually meant __getattribute__ sorry.


The point is that when you write
x.foo(y)
in py you're looking up foo, then calling it with y.
Actually you can even store x.foo away and call it later
f=x.foo

in ST you can't cause you're not doing a dict lookup when you write
x foo: y

obviously you could send another message asking for x to give you a 
method foo: object


Not that one is better than other just a subtle difference.



More information about the Python-list mailing list