[IronPython] dynamic types
korpse-ironpython at kaydash.za.net
Wed Aug 16 13:37:30 CEST 2006
Aviad Rozenhek wrote:
> what I would like is to expose the "DynamicProperties" of my class as
> "actual" properties in IP, which is logical since IP is dynamic.
I'm not sure if there is a way you can implement __getattr__ in your C# class
(and have IronPython Do The Right Thing,) but you could do something like the
following IronPython code:
def __getattr__(self, attr):
raise AttributeError, "'%s' object has no attribute '%s'" %
Assuming of course your GetDynamicProperty method throws an exception when
trying to get a property that doesn't exist, otherwise modify accordingly.
When you meet a master swordsman,
show him your sword.
When you meet a man who is not a poet,
do not show him your poem.
-- Rinzai, ninth century Zen master
More information about the Ironpython-users