Indeed I have now found a way around this, check out this gist: https://gist.github.com/filmor/58f5099f96570c64b1d3
The implementation of the member access is done by basically translating the code that the C# compiler produces when accessing dynamic properties to Python.
Note: Strictly speaking this does _not_ implement full support, as it only helps classes that derive from DynamicObject, not those that only implement IDynamicMetaObjectProvider.
@filmor what is the use case for exposing DLR types in python?
My particular use case is a configuration library that allows for constructs like:
string proxy = c.proxy.http;
where c is a dynamic object of which the members are implicitly created by reading from the config. It allows us to pass partial configuration around easily and reduces string-littering.
@filmor can this be used to access dynamic attributes of COM objects? if yes, can you provide minimal example?
@filmor here is my first attempt at using com objects from pythonnet:
https://gist.github.com/denfromufa/ec559b5af41060c5ac318f7f59d8b415#file-excel_interop_vsto-ipynb
@filmor how would you add support for IDynamicMetaObjectProvider?
This looks really powerful library:
https://github.com/ekonbenefits/dynamitey/wiki/UsageReallyLateBinding
Most helpful comment
Indeed I have now found a way around this, check out this gist: https://gist.github.com/filmor/58f5099f96570c64b1d3
The implementation of the member access is done by basically translating the code that the C# compiler produces when accessing dynamic properties to Python.
Note: Strictly speaking this does _not_ implement full support, as it only helps classes that derive from
DynamicObject, not those that only implementIDynamicMetaObjectProvider.