[IronPython] Overriding .NET methods within IronPython
brian.curtin at gmail.com
Fri Oct 23 11:45:50 PDT 2009
I think I got this right, and it seems to work, but I just feel like there
is probably a better way to override a method in IP. Some time spent
googling doesn't bring anything up except for IP/C# code examples containing
the override keyword. For example, I want to override the Form class' OnLoad
method, so I wrote a decorator to do so.
base = super(Form, args) #args is frm instance
base_method = getattr(base.__thisclass__, method.__name__)
method(*args) #call our method first
def OnLoad(self, evt_args):
It doesn't do anything snazzy - just prints out the EventArgs, then calls
the base class Form.OnLoad.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users