This is almost what I want but I to pass and instance of a class(no static methods) and have python treat it as if it were static method. After re-evaluating what I want I can see why it might not be possible. So if it ends up that I can't do what I described I will use on of the many other methods indicated.

Thanks for the help

--------------------------------------------------
From: "Dino Viehland" <[email protected]>
Sent: Tuesday, June 22, 2010 6:56 PM
To: "Discussion of IronPython" <[email protected]>
Subject: Re: [IronPython] Modules in hosted enviroment

Jeff wrote:
Hi Ross,
It sounds like you want Dino's suggestion IAttributesCollection, which
will give you much more flexibility. I've never done that, but it
looks fairly straightforward.

> An unrelated issue I have with ScriptScope is I can't figure out to add
> overloaded functions with different parameter counts for defaults I'm > using
> 3.5 if it matters.

Dino?

I assume what you have here is a bunch of static methods declared somewhere and you want to publish them in the scope? The only way to really go about doing this is getting the BuiltinFunction object for them and then publishing that in the scope. To get the BF you'll need to first get the PythonType and then
get the BF.  Such as:

public class MyObjectModel {
public static void Foo() {
}

public static void Foo(object x) {
}
}

Using C# 4.0 then I think you could do:

dynamic foos = ((dynamic)DynamicHelpers.GetPythonTypeFromType(typeof(MyObjectModel))).Foo;

or you could do:

object foos = engine.Operations.GetMember(DynamicHelpers.GetPythonTypeFromType(typeof(MyObjectModel))), "Foo");
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to