[IronPython] Overloaded Properties

Martin Maly Martin.Maly at microsoft.com
Tue Sep 26 19:29:38 CEST 2006

There is actually a bug in IronPython. In the case of overloaded properties IronPython doesn't handle the overloads and exposes only the property which was retrieved last via the reflection. In some cases it may be the parameter-less property, in some cases it may be the indexer, depending on the compiler/metadata etc.

In your case, the property returning an array of Costume is not accessible via IronPython at all and the only workaround is to rename the property in VB and avoid the conflict.


From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Rob Ashton
Sent: Tuesday, September 26, 2006 8:02 AM
To: users at lists.ironpython.com
Subject: [IronPython] Overloaded Properties

Apologies if this one seems obvious, I'm not a python programmer J

I've embedded the PythonEngine into a Visual Basic application that I've been writing on and off for the past few months, and one of the nice things that Visual Basic has over C# is of course multiple indexed properties and all the gubbins that come with it.

So, I've got these two properties:

    ''' <summary>
    ''' Costumes that the Engine has access to
    ''' </summary>
    Public ReadOnly Property Costumes() As Costume()


    ''' <summary>
    ''' Gets a Costume By Resource Name
    ''' </summary>
    Public ReadOnly Property Costumes(ByVal name As String) As Costume

When writing Python in my Scripting window, I can access the indexed property easily enough with the following Python. ( Engine is the global variable which exposes the entire object model within this application )


Now. How do I access the plain good ol' Array of costumes so I can run some batch testing scripts which was the whole purpose of throwing IronPython into this application?

I want to do something like:

for costume in Engine.Resources.Costumes:
 print costume.GameName

for example, but of course it think's I'm trying to access the indexed property and gets very confused!

I looked at some earlier list postings which talked about using [type] as a way of specifying when calling methods, but other than that I've been Googling for over an hour and have found nothing.

Am I going to have to move that property into a function called GetCostumes() to make this work? J

- Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060926/bca8b91d/attachment.html>

More information about the Ironpython-users mailing list