Python Macros
Arich Chanachai
macrocosm at fastmail.fm
Wed Oct 6 13:09:02 EDT 2004
<SNIP>
>>In ObjC it would be send the message y with value z to object X
>>Say X doesn't know what to do with y
>>specified in X's code are instruction that tell it what object to pass
>>the message y to...say...U for example
>>
>>So the message has been passed and basically translates into U.y(z) or
>>in ObjC [U y:z]
>>
>>
>
>You mean some refinement of this sort of thing:
>
> class X(object):
>
> a = "lives in X"
>
> def __getattr__(self, name):
> return getattr(U,name)
>
> class U(object):
>
> b = "lives in Y"
>
> x = X()
> print x.a
> print x.b
>
>?
>
>
Sure, but what if I dynamically (at runtime) extend X to include
variable b. Will it then print X.b or still U.b?
More information about the Python-list
mailing list