[IronPython] Overloaded Properties

Rob Ashton robashton at driveworks.co.uk
Tue Sep 26 17:02:02 CEST 2006


Apologies if this one seems obvious, I'm not a python programmer :-)

 

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()

 

 

And

 

 

    ''' <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 )

 

Engine.Resources.Costumes["f_stunt_burn"]

 

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? :-)

 

- Rob

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


More information about the Ironpython-users mailing list