[IronPython] How to dynamically define and call a function?
garys at ihug.com.au
Mon Sep 18 13:04:45 CEST 2006
d'oh! I knew there must have been a straightforward way.
I'm still curious as to how to use the IronPython.Hosting stuff though, as I
thinkultimately it might prove to be more what I'm really after.
> This works for me:
> IronPython 1.0.2449 on .NET 2.0.50727.42
> Copyright (c) Microsoft Corporation. All rights reserved.
>>>> code = "def add(x, y):\n\treturn x + y\n"
>>>> exec code
>>>> add(2, 3)
More information about the Ironpython-users