[Python.NET] Reasons to use ironpython

Michael Foord fuzzyman at voidspace.org.uk
Thu Jun 11 15:42:22 CEST 2009


Hello Matthew,

Why send an email about IronPython to the Python.NET mailing list? 
(Sorry for multiple replies by the way - my client went bat-crazy on me.)

Both Python and C# are 'general purpose' programming langugages suited 
to a wide range of problem domains. Choice of programming language is 
therefore *usually* a matter of aesthetics, what you are used to, 
personal workflow, issues within a team and so on rather than a matter 
of which is more appropriate to the job. Obviously there are exceptions 
where one language is obviously more appropriate or obviously 
inappropriate but these are the exception rather than the rule.

Place where you should *obviously* use IronPython:

* For embedding as a user scripting language / plugin mechanism or are 
doing runtime code generation

Place where you should obviously use C#:

* You have already implemented in a dynamic language, profiled and 
optimised, and *need* faster performance than the dynamic language is 
capable of

Other than that the choice is yours!

Reasons why I / some people prefer IronPython:

* The interactive environment is an invaluable tool for exploration
* No need to create a whole 'object-oriented-application' for simple 
tasks where it is not needed
* Without a compile phase and with duck typing / dynamic typing 
IronPython makes it *dramatically* easier to do test driven development 
or even normal unit testing
* Python has many language capabilities missing from C# which make it a 
flexible and concise language. These include:
- Duck typing (no need for interfaces)
- Heterogeneous containers (no need for generics)
- Pain free introspection (no need for the complexity inherent in 
System.Reflection)
- Metaprogramming including good old eval, type creation at runtime, 
decorators and descriptors
- Late binding and runtime type dispatch
- 'Little features' like tuple unpacking, returning multiple values, 
everything is an object (including primitives, functions, classes and 
modules)

There are things that C# has that Python doesn't (compile time checking, 
method overloading, access to .NET attributes), but choose whichever you 
prefer. :-)

Michael


Harelick, Matthew wrote:
>
> Hi:
>
> My background is primarily UNIX. I have been programming in C, TCL, 
> Perl, and Python in UNIX and Linux for a long time.
>
> I recently started working in Visual Studio and C#.
>
> Visual Studio and C# make everything very easy. Python was nice when 
> you didn’t have the convenience of Visual Studio and intellisense with 
> a nice debugger.
>
> In the windows world I see no major reason not to use C#.
>
> Why would I want to use IronPython?
>
> Thanks
>
> Matthew Harelick
>
> ------------------------------------------------------------------------
>
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet


-- 
http://www.ironpythoninaction.com/



More information about the PythonDotNet mailing list