23
IronPython combines the best of Python and .NET. IronPython Nick Hodge Professional Geek, Microsoft Australia @nickhodge [email protected]

SyPy IronPython

Embed Size (px)

Citation preview

IronPython combines the best of Python and .NET.

IronPython

Nick HodgeProfessional Geek, Microsoft Australia@[email protected]

General Courtney Hicks Hodges

“Gold” Arromanches, Normandy, France

Inspiration“The speed of the current system is so low as to render the current

implementation useless for anything beyond demonstration purposes.” – ActiveState’s report on Python for .NET

“The CLI is, by design, not friendly to dynamic languages. Prototypes were built, but ran way too slowly.” – Jon Udell, InfoWorld, Aug. 2003

• How could Microsoft have screwed up so badly that the CLR is far worse than the JVM for dynamic languages?– Jython shows that dynamic languages can run well on the JVM

• I decided to write a short pithy paper called, “Why .NET is a terrible platform for dynamic languages”

.NET ?.?DLR2

.NET 4.0

.NET 3.5LINQ

DLR

.NET 2.0

The Common Language Runtime

.NET 1.0GC

BCL

ReflectionJIT

GenericsIn Runtime

ExpressionTrees

ExtensionMethods

StatementTrees

Call Site Caching

DynamicDispatch

DynamicCodegen

VerifierSandbox

Silverlight

FastDelegates

DynamicMethods

Script Hosting ??? ???

PythonBinder

RubyBinder

COMBinder

JavaScriptBinder

ObjectBinder

Dynamic Languages on .NET

Dynamic Language Runtime

Statement Trees Dynamic Dispatch Call Site Caching

IronPython IronRuby C# VB.NET Others…

• Today it shares a site with IronPython– http://codeplex.com/ironpython

• Next month it will move to its own site• MSPL is a permissive Open Source license

• Core V1 components – Trees, Sites, Binders– Will ship in .NET Framework 4.0– Base for C# 4.0’s dynamic

• Future pieces are also available today– Microsoft.Scripting.dll for now

DLR is under MSPL and on codeplex

When to use IronPython?

IPy 1.0• Shipped

Sept. 2006• v2.4

language compatibility

• 27/54 built-in modules

IPy 1.1• Shipped

April 2007• Limited v2.5

language features

• More Modules

• Top user issues

• VS Integration(VSX sample)

IPy 2.0• Current

Focus• Fall 2008• v2.5

language compatibility

• Built on DLR• More

modules• Top User

Issues

IPy 2.6• Alpha

Released• H1 2009• v2.6

language compatibility

• Productize VS integration

IPy 3.0• In Planning• H2 2009 ?• Python

3000 language compatibility

• Support for next version of VS

IronPython Roadmap

LINQ?

Standard Pystone Benchmarkhigher numbers are better

0K10K20K30K40K50K60K70K80K90K

100K

IronPython0.1

Python2.3

IronPython1.0

IronPython2.0beta5

Python2.5

Python2.1

46K

101K90K

80K

50K36K

Two Object Worlds == Pain

Python Objects

C-BasedObjects

py1 c2

IronPython can interop with code written in other .NET lanugages.

Extending IronPython in C#namespace noddy { public class Noddy { public string first, last; public Noddy(string first, string last)

{ this.first = first; this.last = last; } }}

IronPython is embeddable in .NET applications.

import clrclr.AddReference("IronPython.dll")from IronPython.Hosting import PythonEngine

engine = PythonEngine.CurrentEnginescope = engine.CreateScope()source = engine.CreateScriptSourceFromString('6*9')

result = source.Execute(scope)

http://ironpython.codeplex.com/ironpython(Including SVN access to source)

IronPython combines the best of Python and .NET.

IronPython

Nick HodgeProfessional Geek, Microsoft Australia@[email protected]