IronPython: Bug? / Feature Request:mutable attributes on .NET classes.

Oct 14, 2006 at 2:03 AM
What is the rationale behind making the _dict_ attribute dictionary immutable for .net objects? For instance, the following code sample will demonstrate what I mean; you can set any attributes you want in classes created in IronPython,

but classes coming from .NET have different rules. In the aim of both ease of use and consistency, I think this should be addressed in the next release of IronPython. You may have already considered this, and if there's a technical reason for the status quo, I would like you to enlighten me =]. Thanks.

import clr


from System.Windows.Forms import *

  1. part 1: This makes #2 possible.

class Button(Button): pass

button = Button()

button.Text = "Click Me!"

  1. part 2: Without part 1, this is an error because Button()'s _dict_ is immutable.

button.clickText = "You clicked me!"

class MainForm(Form):

def _init_(self):


button.Click += lambda sender, e: MessageBox.Show(button.clickText)

if _name_ == '_main_':