Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add support for DLR types #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
filmor opened this issue Apr 16, 2015 · 7 comments
Open

Add support for DLR types #72

filmor opened this issue Apr 16, 2015 · 7 comments

Comments

@filmor
Copy link
Member

filmor commented Apr 16, 2015

Using this it's possible to implement all required functionality in a separate DLR meta-class. I've already tried to do this in Python but sadly the .NET types (or their representation in Python-space) are not patchable.

@filmor
Copy link
Member Author

filmor commented Apr 20, 2015

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.

@den-run-ai
Copy link
Contributor

@filmor what is the use case for exposing DLR types in python?

@filmor
Copy link
Member Author

filmor commented Apr 15, 2016

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.

@den-run-ai
Copy link
Contributor

@filmor can this be used to access dynamic attributes of COM objects? if yes, can you provide minimal example?

@den-run-ai
Copy link
Contributor

@filmor here is my first attempt at using com objects from pythonnet:

https://gist.github.com/denfromufa/ec559b5af41060c5ac318f7f59d8b415#file-excel_interop_vsto-ipynb

@den-run-ai den-run-ai mentioned this issue Sep 7, 2016
@den-run-ai
Copy link
Contributor

@filmor how would you add support for IDynamicMetaObjectProvider?

@den-run-ai
Copy link
Contributor

This looks really powerful library:

https://github.com/ekonbenefits/dynamitey/wiki/UsageReallyLateBinding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants