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:

import YourAssembly

class DynamicPropertiesContainer(YourAssembly.DynamicPropertiesContainer):
     def __getattr__(self, attr):
         try:
             return self.GetDynamicProperty(attr)
         except NoSuchDynamicProperty:
             raise AttributeError, "'%s' object has no attribute '%s'" % 
(type(self).__name__, attr)

Assuming of course your GetDynamicProperty method throws an exception when 
trying to get a property that doesn't exist, otherwise modify accordingly.
-- 
Jonathan

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
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to