No, that's the right class. Apparently, it's been changed a bit since ~late October when we branched off the 2.0 source.<br><br>
<div class="gmail_quote">On Tue, Apr 14, 2009 at 11:58 AM, Alex News <span dir="ltr"><<a href="mailto:anleewxs@gmail.com">anleewxs@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Well I am either suffering from severe user error, or it is not in the<br>suggested locations. The best I could find was<br>
Microsoft.Scripting.Actions.Dynamic. It implements IDynamicObject.<br>It does not have the aforementioned TryGetMember function to override,<br>but does have a GetMember function to override.<br>
<div>
<div></div>
<div class="h5"><br><br>On Tue, Apr 14, 2009 at 2:31 PM, Dino Viehland <<a href="mailto:dinov@microsoft.com">dinov@microsoft.com</a>> wrote:<br>> I think it might be just “Dynamic” in 2.0.<br>><br>><br>><br>
> From: <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a><br>> [mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>] On Behalf Of Curt Hagenlocher<br>
> Sent: Tuesday, April 14, 2009 11:05 AM<br>> To: Discussion of IronPython<br>> Subject: Re: [IronPython] **kwargs and __getattr__ handling in csharp<br>> functions and classes?<br>><br>><br>><br>> It should be Microsoft.Scripting.DynamicObject in 2.0.<br>
><br>> On Tue, Apr 14, 2009 at 11:02 AM, Alex News <<a href="mailto:anleewxs@gmail.com">anleewxs@gmail.com</a>> wrote:<br>><br>> Current IronPython = 2.01? I have Microsoft.Scripting.Core<br>> referenced, and can't find DynamicObject. There is an<br>
> Microsoft.Scripting.Actions.IDynamicObject, and a<br>> Microsoft.Scripting.Runtime.IOldDynamicObject. I'm sure I'm missing<br>> something very basic.<br>><br>> We are using .net 2.0.50727 SP1<br>
><br>><br>><br>> On Tue, Apr 14, 2009 at 12:12 PM, Curt Hagenlocher <<a href="mailto:curt@hagenlocher.org">curt@hagenlocher.org</a>><br>> wrote:<br>>> In current versions of IronPython, DynamicObject is in<br>
>> Microsoft.Scripting.Core as Microsoft.Scripting.DynamicObject. In .NET<br>>> 4.0<br>>> System.Core, the same class will be called System.Dynamic.DynamicObject.<br>>> (I<br>>> just noticed this naming discrepancy today, and I think we should probably<br>
>> move it to at least Microsoft.Dynamic for the 2.6 release.)<br>>><br>>> On Tue, Apr 14, 2009 at 8:31 AM, Alex News <<a href="mailto:anleewxs@gmail.com">anleewxs@gmail.com</a>> wrote:<br>>>><br>
>>> Much appreciated, I will give that a try. In what namespace is<br>>>> DynamicObject declared? (I assume the required assemblies are already<br>>>> referenced if I'm pulling in IronPython).<br>
>>><br>>>> Thanks again,<br>>>> Alex<br>>>><br>>>><br>>>> On Tue, Apr 14, 2009 at 11:16 AM, Dino Viehland <<a href="mailto:dinov@microsoft.com">dinov@microsoft.com</a>><br>
>>> wrote:<br>>>> > For kwargs you need to decorate the function w/ a ParamDictionary<br>>>> > attribute such as:<br>>>> ><br>>>> > public void __init__(CodeContext/*!*/ context, object o,<br>
>>> > [ParamDictionary] IAttributesCollection kwArgs)<br>>>> ><br>>>> > For __getattr__ IronPython will recognize a special name<br>>>> > "GetBoundMember" method such as:<br>
>>> ><br>>>> > using System;<br>>>> > using System.Runtime.CompilerServices;<br>>>> ><br>>>> > public class Foo {<br>>>> > [SpecialName]<br>>>> > public object GetBoundMember (string name) {<br>
>>> > return name;<br>>>> > }<br>>>> > }<br>>>> ><br>>>> ><br>>>> > You can also do "GetCustomMember" which is like __getattribute__. But<br>
>>> > for this one what you really want to do is inherit directly from the<br>>>> > DynamicObject class and override TryGetMember. Then it'll work not<br>>>> > only w/<br>>>> > Python but w/ other DLR based languages as well (e.g. C#, <a href="http://vb.net/" target="_blank">VB.NET</a>,<br>
>>> > IronRuby,<br>>>> > etc...).<br>>>> ><br>>>> ><br>>>> >> -----Original Message-----<br>>>> >> From: <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-">users-</a><br>
>>> >> <a href="mailto:bounces@lists.ironpython.com">bounces@lists.ironpython.com</a>] On Behalf Of Alex News<br>>>> >> Sent: Tuesday, April 14, 2009 7:32 AM<br>>>> >> To: <a href="mailto:users@lists.ironpython.com">users@lists.ironpython.com</a><br>
>>> >> Subject: [IronPython] **kwargs and __getattr__ handling in csharp<br>>>> >> functions and classes?<br>>>> >><br>>>> >> I would like to write some functions and classes in csharp that<br>
>>> >> interact nicely python. I would like to write a function that can<br>>>> >> respond to keyword arguments, and a class that can dynamically resolve<br>>>> >> __getattr__.<br>
>>> >><br>>>> >> For the function I tried creating a function that takes a<br>>>> >> IronPython.Runtime.PythonDictionary, but did not work. For a class I<br>>>> >> tried creating a function that have a method __getattr__, but that<br>
>>> >> failed too.<br>>>> >><br>>>> >> I see there is a IronPython.Runtime.PythonFunction and some other<br>>>> >> interesting classes in the Runtime, but it is not apparent exactly how<br>
>>> >> I could use them.<br>>>> >><br>>>> >> I can, luckily, fudge much of what I want to do by creating small<br>>>> >> python classes and functions in python to proxy the values to<br>
>>> >> underlying csharp classes. However thing would be cleaner if I could<br>>>> >> do it directly in csharp.<br>>>> >><br>>>> >> Thanks in advance for any suggestions.<br>
>>> >><br>>>> >> Alex<br>>>> >> _______________________________________________<br>>>> >> Users mailing list<br>>>> >> <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
>>> >> <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>>>> ><br>>>> > _______________________________________________<br>
>>> > Users mailing list<br>>>> > <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>>>> > <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
>>> ><br>>>> _______________________________________________<br>>>> Users mailing list<br>>>> <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>>>> <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
>><br>>><br>>> _______________________________________________<br>>> Users mailing list<br>>> <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>>> <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
>><br>>><br>> _______________________________________________<br>> Users mailing list<br>> <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>> <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
><br>><br>><br>> _______________________________________________<br>> Users mailing list<br>> <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>> <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
><br>><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</div></div></blockquote></div><br>