I've been wondering to myself, what uses does IronPython have in a .NET environment? what can it do that can't be done with VB, C# or F#? It seems kind of strange to go through all the trouble of making the DLR and enabling dynamic languages on the clr just to add another language.
What do people use IronPython for?
|
|
|||||||||
|
|
IronPython (or DLR languages in general) make some things extremely easy that are very hard to do with compiled .NET languages. Some use cases would include: Use case 1: In a C# application, you have a string like Use case 2: You want to allow your users to enhance your C# application's functionality with some kind of macro facility. If you use a DLR language for that, the script code automatically has access to the plain old .NET objects you give it as parameters or put in the script's global scope. Use case 3: You want to make some part of your code be easy to change, possibly at runtime. (Think business logic.) You want more changeability than a config file can offer but you don't want to adjust your application's source code for every installation. So you make some part of the code dynamic, load it at runtime and let it interact with your host application. Use case 4: You want to write your application in a dynamic language because you think it's the best tool for this specific task, but you need some .NET library. |
|||
|
|
The key question for me was "why Python instead of PowerShell?" I admittedly haven't spent that much time with PowerShell but it just repels me for some reason, and I'm taking it as an opportunity to learn a language that I can use to expand my thinking and use outside the .NET ecosystem as well (full-time C# dev here). |
|||
|
|
|
I would guess they use it for making .NET applications, written in Python instead of C# or VB or F#. Probably they do this if they don't know C#/F#/VB, but they do know Python. Using the .NET framework gives you access to all the existing .NET libraries which may or may not have equivalent functionality in other Python libraries. And it would make interactions between IronPython components and other .NET components easier. This matters if you work in a place that uses the .NET stack. |
|||||||||||||||
|
|
I think the DLR was designed for the cool new features in .NET 4, like LINQ that requires some of them. Then Microsoft decided to either:
I'm surprised they didn't do IronJava but they might still be smarting over losing the lawsuit (or maybe there's all kind of further legal issues they didn't want to handle). |
|||||||||||||||||||
|
|
IronPython Has access to both the .Net world and the standard python world. Which was really nice. I mostly used IronPython for loading up my classLibs so I could play with them in an interactive terminal. It made for easy debugging. |
|||
|
|
