[IronPython] Choosing the right overload

Jonathan Jacobs korpse-ironpython at kaydash.za.net
Fri Jun 16 12:25:09 CEST 2006


Hi,

I'm wondering how to call a specific overload, more specifically one that in 
C# would take an out parameter but in IronPython does/can not.

Here are the available overloads:

 >>> print Direct3D.Mesh.FromFile.__doc__
static (Mesh, array_EffectInstance) FromFile(str filename, MeshFlags options, 
Device device)
static (Mesh, GraphicsStream, array_EffectInstance) FromFile(str filename, 
MeshFlags options, Device device)
static (Mesh, array_ExtendedMaterial, array_EffectInstance) FromFile(str 
filename, MeshFlags options, Device device)
static Mesh FromFile(str filename, MeshFlags options, Device device)
static (Mesh, GraphicsStream) FromFile(str filename, MeshFlags options, Device 
device)
static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags 
options, Device device)
static (Mesh, GraphicsStream, array_ExtendedMaterial) FromFile(str filename, 
MeshFlags options, Device device)
static (Mesh, GraphicsStream, array_ExtendedMaterial, array_EffectInstance) 
FromFile(str filename, MeshFlags options, Device device)

I want to call:

static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags 
options, Device device)

I've tried using __overloads__:

 >>> print Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, 
Direct3D.Device)].__doc__
static Mesh FromFile(str filename, MeshFlags options, Device device)

I'm going to assume that I'd need some way to specify the return type, which 
also makes me wonder how you'd specify an object of type array_ExtendedMaterial?

So, is there a way I can do this without resorting to writing a C# helper 
function?

I'd also like to suggest that the representation of the "keys" in 
__overloads__ change to look something a little more like what you need to 
pass. For instance:

'static (Mesh, array_EffectInstance) FromFile(str filename, MeshFlags options, 
Device device)': <built-in function FromFile>

would be more easily understood (IMO) if it looked like:

(str, MeshFlags, Device): <built-in function FromFile>

Regards
-- 
Jonathan

When you meet a master swordsman,
show him your sword.
When you meet a man who is not a poet,
do not show him your poem.
                 -- Rinzai, ninth century Zen master



More information about the Ironpython-users mailing list