[IronPython] Problem with keyword parameters for built-in types

Jim Hugunin jimhug at exchange.microsoft.com
Sat Nov 5 01:26:07 CET 2005


Thanks for the bug report.  We'll add it to the list to fix.  I assume that you know that you can do this as a work-around:
  property(_getValue, None, None, "This is doc")

The unhandled exception change is my fault.  I made the change because it makes debugging IronPython applications within visual studio much nicer since you can break at the point at which an unhandled exception is thrown.  I didn't believe this would be a problem for folks since my personal development style very rarely directly runs scripts.  I'm either working within the interactive console using import, reload and execfile or I'm working inside of VS.  This also came up as I was adding some support for simple static compilation and I think this is the right behavior for Python code compiled to a single .exe.

However, I think your right that this is a mistake for simple cases of "IronPythonConsole foo.py" and we should revert to the old behavior for 0.9.5 while adding a flag to enable the new behavior inside of a debugger like VS.

Thanks for the two bugs - Jim


________________________________

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of John Doty
Sent: Thursday, November 03, 2005 2:15 PM
To: Discussion of IronPython
Subject: [IronPython] Problem with keyword parameters for built-in types

I'm sorry if this is a known limitation, but the following doesn't work with IronPython 0.9.3:

  class MyClass:
      def __init__(self, testValue):
          self.testValue = testValue

      def _getValue(self):
          return self.testValue
      value = property(_getValue, doc="This is documentation")

  obj = MyClass("Hello!")
  print obj.value

It generates the following exception:

  Traceback (most recent call last):
     at __main__.Initialize() in C:\IronPython\test.py:line 1
     at __main__.MyClass$maker0() in C:\IronPython\test.py:line 7
  TypeError: can't set arbitrary attributes on built-in type property

I just thought I'd point it out.

(In addition, running this in IronPythonConsole.exe 0.9.4 gives me an unhandled exception, as opposed to the nice exception-with-stack-trace that I used to get, and expect from CPython development. Is this on purpose?)

thanks,
john
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20051104/f0c03e54/attachment.html>


More information about the Ironpython-users mailing list