Re: [IronPython] dynamic types

2006-08-16 Thread Jonathan Jacobs
Aviad Rozenhek wrote: what I would like is to expose the DynamicProperties of my class as actual properties in IP, which is logical since IP is dynamic. I'm not sure if there is a way you can implement __getattr__ in your C# class (and have IronPython Do The Right Thing,) but you could do

Re: [IronPython] Typing problem with vendor library?

2006-07-20 Thread Jonathan Jacobs
jeff sacksteder wrote: errorlevel = board.AIn(channel,mode,output) TypeError: no overloads of AIn could match (int, Range, int) AIn(int, Range, Reference[Int16]) AIn(int, Range, Reference[UInt16]) What are the contents of board.AIn.Overloads? This might give you some idea of why your

[IronPython] repr...huh?

2006-07-13 Thread Jonathan Jacobs
v = Vector3(1, 2, 3) v ...]osoft.DirectX.Vector3 object at 0x002C [Z : 3 Huh? -- Jonathan ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Re: [IronPython] Importing embedded .py files

2006-07-04 Thread Jonathan Jacobs
Nathan R. Ernst wrote: Out of curiosity, is there any sort of hook into the engine that would allow you search for a module on your own? e.g. a search of sys.path did not find I'm not sure how well this is going to work with IronPython, but in CPython you're advised to use ihooks

Re: [IronPython] How to get System.Single[]?

2006-06-22 Thread Jonathan Jacobs
Kevin Bjorke wrote: I need to create a list of Singles to use System.Drawing.Darwing2D.ColorBlend's Position member. Color me ignorant, but how can I create such a thing? I can't just pass a list of floats It would be convenient to pass a tuple of floats, too bad this doesn't work. You can

Re: [IronPython] the new version cannot find an overload for ToolStripItemCollection.AddRange when using a list

2006-06-20 Thread Jonathan Jacobs
Cheemeng wrote: the doc for ToolStripItemCollection.AddRange list the 2 overloads as: ToolStripItemCollection.AddRange (ToolStripItem[]) ToolStripItemCollection.AddRange (ToolStripItemCollection) in prev ironpython version, we can pass a python list as argument, in the newest version, this

[IronPython] .NET constructors

2006-06-19 Thread Jonathan Jacobs
Hi, (I didn't see any of these things on the CodePlex issue tracker, sorry if these are old news.) Trying to define a class that derives from my .NET object, with a single constructor that takes more than 4 arguments, explodes: Test.cs: public class Test { public Test(int a, int b, int

[IronPython] Choosing the right overload

2006-06-16 Thread Jonathan Jacobs
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,

Re: [IronPython] Choosing the right overload

2006-06-16 Thread Jonathan Jacobs
Jonathan Jacobs wrote: Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, Direct3D.Device, clr.GetClrType(Direct3D.ExtendedMaterial).MakeArrayType())] Traceback (most recent call last): File , line 0, in stdin##22 File , line 0, in get_Item##18 TypeError: No match found

Re: [IronPython] Choosing the right overload

2006-06-16 Thread Jonathan Jacobs
Jonathan Jacobs wrote: I did some digging in the source code, it looks like the problem is the indexer for BuiltinFunctionOverloadMapper. The problem appears to be: from Python I am unable to specify whether an argument is byref or not and so the comparison fails when trying to match

Re: [IronPython] CPython reflector (work-in-progress)

2006-06-08 Thread Jonathan Jacobs
Dino Viehland wrote: To get a better stack trace I would suggest you run w/ -X:ExceptionDetail command line option which will give you the raw exception info thrown by the CLR. By default we exclude all of the IronPython, mscorlib, etc... frames and just give you the frames that you presumably

Re: [IronPython] help(), in the mean time

2006-06-01 Thread Jonathan Jacobs
Sanghyeon Seo wrote: Currently help() raises NotImplementedError. But in the mean time, I would like to have help(obj) as an equivalent to print obj.__doc__. It's not like CPython's help(), but it is certainly more useful than the current behaviour. I was going to suggest using pydoc.help

[IronPython] Optimized methods and serious performance issues

2006-05-25 Thread Jonathan Jacobs
(Please disregard any earlier message about this, I think I might have pressed Send accidentally.) Hi, I ran across some interesting behaviour today. Short version: I have a handful of Direct3D.Mesh objects (courtesy of Direct3D.Mesh.Teapot) which I render using

Re: [IronPython] __repr__ and __str__ for .NET types

2006-05-24 Thread Jonathan Jacobs
Neville Bagnall wrote: FWIW in the general case I would have something equivalent to: def GenRepr(object): strrep=object.ToString() if len(strrep)40 and strrep.find('\n')==-1: return %s: %s % (object.__class__.__name__, repr(strrep)[1:-1]) else: return %s

[IronPython] __repr__ and __str__ for .NET types

2006-05-23 Thread Jonathan Jacobs
Hi, In all the cases I've seen, calling repr on a .NET type ends up calling ToString which is generally reasonably useful but almost always unnecessarily verbose. Sometimes it would be nice if it gave you something a little more specific about the object in question, something less like: v

Re: [IronPython] __repr__ and __str__ for .NET types

2006-05-23 Thread Jonathan Jacobs
Nicholas Bastin wrote: No, actually it doesn't. The string returned by __repr__ should be able to be used to re-create the object, if that is possible. In this case, 'X: 0\nY: 0\nZ: 0\n' is a *lot* closer to re-creating the object than 'Foo object at 0x002B' is. The

Re: [IronPython] __repr__ and __str__ for .NET types

2006-05-23 Thread Jonathan Jacobs
Nicholas Bastin wrote: Generally we try to meet in the middle on __repr__ - in many cases, it's most convenient if the output from __repr__ can be fed back into a factory or constructor for the class the text came from, so that the following expression is legal: new_object =

Re: [IronPython] Overriding derived methods

2006-05-22 Thread Jonathan Jacobs
Dino Viehland wrote: There's a bug in beta 5 and beta 6 where we can sometimes fail to call the correct derived method. You can work around the bug in many cases w/: Class MyForm(Form): def __init__(self): self.OnKeyUp = self.OnKeyUp def OnKeyUp(self, e):

Re: [IronPython] Static methods that look similar to instance methods?

2006-05-08 Thread Jonathan Jacobs
J. Merrill wrote: In C# you could use Vector3.Unprojectbut that might not work in IP. Have you tried it? I guess I neglected to mention the part where I explained what I was doing. :) Calling Vector3.Unproject (in an attempt to call the static method) results in a None return value,

Re: [IronPython] Static methods that look similar to instance methods?

2006-05-08 Thread Jonathan Jacobs
Simon Dahlbacka wrote: I suppose the problem is that the following is valid (and even used) python code Quite right. Btw, why do you need both a static and a non-static method with the same name? Well, it's not my code, it's from the Managed DirectX API. -- Jonathan

[IronPython] Attempt to update field 'Z' on value type 'Vector3'; value type fields cannot be directly modified

2006-05-07 Thread Jonathan Jacobs
Hi, me again! I realise the error seems logical enough, but it isn't right. The documentation for Vector3 specifies that the fields X, Y and Z are all read/write and indeed C# code has no boggle doing just that. Vector3.GetType().IsValueType is true; I guess relying on IsValueType isn't

Re: [IronPython] Attempt to update field 'Z' on value type 'Vector3'; value type fields cannot be directly modified

2006-05-07 Thread Jonathan Jacobs
Sanghyeon Seo wrote: Have you read this? http://channel9.msdn.com/wiki/default.aspx/IronPython.ValueTypes As far as I understand the Vector3 type: it is a struct with public fields, are these subject to these quirks too? One wouldn't expect structs to need getters and setters that somewhat

Re: [IronPython] who is using ironpython in projects ?

2006-05-06 Thread Jonathan Jacobs
Kevin Bjorke wrote: We are: http://developer.nvidia.com/object/fx-composer2-pipeline-gdc-2006.html That is a pretty awesome looking piece of software, Kevin! -- Jonathan ___ users mailing list users@lists.ironpython.com

[IronPython] Overriding derived methods

2006-05-05 Thread Jonathan Jacobs
Hi, I'm wondering how I override methods in a derived object, I'm not sure whether this is the problem I'm experiencing or not but it looks that way. Defining my own form object, with OnKeyUp method: class MyForm(Form): ... def OnKeyUp(self, e): ... print '!!!' ...

Re: [IronPython] MapPoint COM object?

2006-04-17 Thread Jonathan Jacobs
Gardner Pomper wrote: Hi, I am trying to manipulate mappoint from an IronPython script. I tried to do the COM integration I found in the Tutorial, but it failed. I have copied what I did into this email. Can someone take a look and tell me what I should have done? I believe the problem

[IronPython] Issues with the OptimizedFunctionAny

2006-04-02 Thread Jonathan Jacobs
Hi, I've stumbled across this interesting behaviour: p = ((1, 2),) zip(*(p * 10)) [(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), (2, 2, 2, 2, 2, 2, 2, 2, 2, 2)] zip(*(p * 10)) Traceback (most recent call last): File , line 0, in input##10 TypeError: zip() takes at most 0 arguments (10 given) Upon

[IronPython] IronPython's file object implementation

2006-03-09 Thread Jonathan Jacobs
Hi, I've got a gripe with IronPython's file implementation. The following code produces two different results in CPython and IronPython: print ''.join('%02x' % ord(c) for c in file('some_binary_file').read(32)) CPython: 01044c1045a1470ec20112012000ec0f03006f1efcc5

Re: [IronPython] IronPython's file object implementation

2006-03-09 Thread Jonathan Jacobs
Dino Viehland wrote: The first bug will be fixed in beta 4 - we've done a bunch of cleanup around the file class to make it all around more compatible with CPython. That not only includes fixing binary mode but also fixing universal new line mode to be much more compatible. FYI beta 4

[IronPython] Binary files and byte strings

2005-12-20 Thread Jonathan Jacobs
Hi, I have a CPython script to parse specific data files and allow me to manipulate them, mostly relying on the struct module. IronPython doesn't seem to have an implementation of this (yet?) so I used PyPy's implementation and discovered that IronPython's sys module doesn't define a

Re: [IronPython] Workaround for -i

2005-12-06 Thread Jonathan Jacobs
Edward K. Ream wrote: Shouldn't the -i option actually be stopping IronPython from exiting Right. That's why opening IronPython from a console is a workaround, not a fix. Technically, a workaround should provide a temporary fix. Simply stopping the console window from disappearing

[IronPython] Events and the += operator

2005-11-23 Thread Jonathan Jacobs
Hi, (I did a couple of searches on the archives and checked the bug tracker but still found nothing directly relating to this. Hopefully I didn't miss anything.) I'm having a problem trying to attach an event handler to System.Windows.Forms.Application.Idle:

Re: [IronPython] Overloads

2005-08-03 Thread Jonathan Jacobs
Martin Maly wrote: the Random.Next is not a static method. You can either pass the instance as the first argument: Hi Martin, Yes, I figured that out a little while later. Too bad I had already made a fool of myself. ;-) However, I think your question brings up a valid point ... how do

Re: [IronPython] Plans for overloads?

2005-07-20 Thread Jonathan Jacobs
Keith J. Farmer wrote: I didn't see a second set of square brackets. Also, what if what you have is an indexer, in which case the parameter is supplied also with square brackets? Then you have a lot of square brackets? ;-) Of course it's not very pretty. Do you have a suggestion that

Re: [IronPython] Plans for overloads?

2005-07-20 Thread Jonathan Jacobs
Keith J. Farmer wrote: Illustrating my concern with indexers: delegate Foo DelegateType(); public static DelegateType this (Type type) { } public FooT() { } x = Foo[typeof(int)]() .. is ambiguous. You can't determine if you've called the constructor, or if you've called the static indexer,

Re: [IronPython] Python extensions

2005-07-17 Thread Jonathan Jacobs
Keith J. Farmer wrote: You can -- at least in asp.net 2 Yes, it appears you can...however IronPython throws away exported types without a namespace. Not sure what the reason for this may be, I'd have thought that classes from an assembly without a namespace should just belong to the

[IronPython] Plans for overloads?

2005-07-15 Thread Jonathan Jacobs
Hi, I am curious as to how function-overloads plan on being handled in future versions of IronPython. -- Jonathan ___ users-ironpython.com mailing list users-ironpython.com@lists.ironpython.com

Re: [IronPython] Plans for overloads?

2005-07-15 Thread Jonathan Jacobs
Martin Maly wrote: The overloaded function resolution (when IronPython calls .Net) is currently being worked on. You probably read the original code in which IronPython chooses the first callable alternative. The new code does better finds out all methods that can be called and tries to choose

[IronPython] from X import Y brokenness

2005-07-05 Thread Jonathan Jacobs
Hi, Recently, I've run across a bit of a bug while importing things with the from X import Y syntax, when Y is anything but an an attribute of X that already exists. Demonstration: IronPython 0.7.6 on .NET 2.0.50215.44 Copyright (c) Microsoft Corporation. All rights reserved. from foo import