On Thu, Dec 1, 2011 at 10:14 AM, Michael Colonno <mcolo...@stanford.edu> wrote: > In VB.NET, this works just fine: > > > > Dim A As Type > Dim Name As String > Dim Option As Boolean > Dim Err As Integer > Dim value As Object > > value = A.function(Name, Option, Err) > > In IronPython I am trying (pseudo-code): > > import clr > clr.AddReferenceToFileAndPath("relevant dll") > from API.Interop.whatever import Type > > A = Type() > value = A.function("Name", True, err) > > Two issues / questions: > > 1. The IronPython code above produces: TypeError: Cannot create > instances of Type because it is abstract. Why is an abstract Python class > being created and do I have any control over this?
Calling `A = Type()` tries to create an instance of Type, which your VB code doesn't do. Is `Type.function` a static method? > > 2. Changing the code to access the functions of Type directly (e.g. > Type.function()) results in a “self” argument being expressed as the first > argument in the function. i.e. the syntax expected is now > Type.function(self, string, boolean, int). I’m familiar with “self” only in > the context of defining class functions and not outside of a class > definition. It really depends on how what the signature of the function is. If it's static, calling `Type.function` from Python shouldn't need a self argument. Can you find the signature of `Type.function` (ILSpy is your friend here). Feel free to elide the names; they're not really important. - Jeff _______________________________________________ Ironpython-users mailing list Ironpython-users@python.org http://mail.python.org/mailman/listinfo/ironpython-users