It&#39;s not a problem at all.<br><br>I was just trying to test the API for a library from the interactive interpreter. When it happened, I remembered that it had bit me before, and this time I just happened to be in a mood to track it down.
<br><br>Thanks,<br>Eric<br><br><div><span class="gmail_quote">On 7/30/07, <b class="gmail_sendername">John Messerly</b> &lt;<a href="mailto:jomes@microsoft.com">jomes@microsoft.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
For what it&#39;s worth, this appears to be fixed in IronPython 2.0 alpha 3:<br><br>&gt;ipy paramcalltest.py<br>args = System.String[](&#39;a&#39;, &#39;b&#39;, &#39;c&#39;)<br>creating ParamCall object:<br>pc.Joined() =&gt; a,b,c
<br><br>If it&#39;s really bothersome we could add it to the 1.1.1 bug list, but in the meantime I&#39;d suggest the workaround Michael mentioned (wrapping the args up in the tuple)<br><br>Cheers,<br>John<br><br>-----Original Message-----
<br>From: <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>] On Behalf Of Eric Rochester
<br>Sent: Monday, July 30, 2007 1:37 PM<br>To: IronPython Users<br>Subject: [IronPython] CLR class constructors and arrays<br><br>Hi,<br><br>I&#39;ve been using IronPython for a few months now, and I&#39;m really enjoying it. Thanks for all the hard work that&#39;s gone into it.
<br><br>I recently ran across an issue, and I wondered if anyone else has seen it. I think it&#39;s probably a bug, but I couldn&#39;t find a bug report, either.<br><br>Basically, if there is a CLR class that takes an array as its only constructor argument, IronPython always tries to call it using params. For example, if I compile this to 
ParamCall.dll:<br>// ParamCall.cs<br><br>using System;<br><br>namespace ParamCall<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;public class ParamCall<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private string[] args;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public ParamCall(string[] args)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.args = args;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public string Joined()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return String.Join(&quot;,&quot;, args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><br>And I call it using this script:<br># 
paramcall.py<br><br>import clr<br>clr.AddReference(&#39;ParamCall&#39;)<br><br>from ParamCall import ParamCall<br>from System import Array<br><br>args = Array[str]( [&#39;a&#39;, &#39;b&#39;, &#39;c&#39;] )<br>print &#39;args =&#39;, args
<br><br>print &#39;creating ParamCall object:&#39;<br>pc = ParamCall(args)<br>print &#39;pc.Joined() =&gt;&#39;, pc.Joined()<br><br>print<br><br>I get these results.<br>C:\home\eric\src\ase\Lse.Net&gt;IronPython\ipy paramcall.py
<br>args = System.String[](&#39;a&#39;, &#39;b&#39;, &#39;c&#39;)<br>creating ParamCall object:<br>Traceback (most recent call last):<br>&nbsp;&nbsp;File C:\home\eric\src\ase\Lse.Net\paramcall.py, line 7, in Initialize<br>&nbsp;&nbsp;File , line 0, in __import__##4
<br>&nbsp;&nbsp;File C:\home\eric\src\ase\Lse.Net\ParamCall.py, line 15, in Initialize<br>&nbsp;&nbsp;File , line 0, in NonDefaultNew##54<br>TypeError: ParamCall() takes exactly 1 argument (3 given)<br><br>I have also tried wrapping the arguments in a tuple and calling it like ParamCall( *(args,) ), but the results are the same.
<br><br>If anyone has any suggestions for work-arounds or clues as to what I&#39;m doing wrong, I&#39;d be glad to hear them.<br><br>Thanks,<br><br>--<br>Eric Rochester<br>_______________________________________________<br>
Users mailing list<br><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
</a><br></blockquote></div><br><br clear="all"><br>-- <br>Eric Rochester<br><a href="http://writingcoding.blogspot.com/">http://writingcoding.blogspot.com/</a><br><a href="http://www.linkedin.com/in/erochester">http://www.linkedin.com/in/erochester
</a>