[IronPython] Default parameters problem In IronPython 1.0

liangml liangml at 6636.com
Wed Mar 8 17:46:31 PST 2006


Hi all:
    It seems that IronPython has a limit about default parameters. Please see this below, I don't know
why the last tow tests work well, but the first one doesn't :(

IronPython 1.0.2255 (Beta) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import System
>>> def foo(a,b,c,d=1,e=2): t=System.Text.Encoding.Default.GetBytes(c)
>>> foo("aaaa","bbbb","cccc")
Traceback (most recent call last):
  File , line 0, in input##1
  File , line 0, in foo
  File , line 0, in foo
Exception: Object reference not set to an instance of an object.
>>> def foo(a,b,c,d=1): t=System.Text.Encoding.Default.GetBytes(c)
>>> foo("aaaa","bbbb","cccc")
>>> def foo(c,d=1,e=2): t=System.Text.Encoding.Default.GetBytes(c)
>>> foo("cccc")
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/users-ironpython.com/attachments/20060309/3f7dd39d/attachment.html


More information about the users mailing list