At the console there's an easy workaround: >>> zip = zip >>> 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)) [(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), (2, 2, 2, 2, 2, 2, 2, 2, 2, 2)]
Unfortunately that doesn't help you in a module where we'll always optimize the method. Another work around that involves changing the source code is updating CanOptimize(MethodBase mi) in IronPython\Compiler\ReflectOptimizer.cs. You can just add something like: if(mi.Name == "zip") return false; and it'll suppress the optimization of that method. We should actually be able to handle more than 5 arguments in this case (via a params arg) so hopefully it's just a simple bug, but I'll have to look into it. The optimization it's self is switching from a late-bound method invocation via reflection to an optimized caller stub. The 5 args limit is for non-params args (it's tricky because we get into having mixed # of arguments in the same method). Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Jacobs Sent: Sunday, April 02, 2006 1:06 AM To: IronPython List Subject: [IronPython] Issues with the OptimizedFunctionAny 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 the first-time calling the method it is a "ReflectedMethod" object, this is then optimized (compiled?) to an "OptimizedFunctionAny" object somewhere along the line, which appears to have problems accepting more than 5 parameters (according to the source code, anyway.) This seems like a pretty serious issue. Is there any way I can get around it in the meanwhile? 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 _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
