最終更新:2011-08-25 (木) 05:51:15 (4628d)  

IronPython
Top / IronPython

http://www.ironpython.net/

.NET Frameworkに対応したPython

IronPython is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework. IronPython can use the .NET Framework and Python libraries, and other .NET languages can use Python code just as easily.

バージョン

IronPythonPython
IronPython 1.1?Python 2.4?
IronPython 2.0?Python 2.5?
IronPython 2.6?Python 2.6
IronPython 2.7?Python 2.7

特徴

IronPython.NET Frameworkと密に統合しているのが特徴で、.NETおよびSilverlight環境で動作する。.NET FrameworkPythonライブラリ、その他の.NET言語が利用できる。

  • 2.0以降はSilverlightアプリケーションを開発可能
  • .NET Frameworkのクラスライブラリにアクセス可能
  • .NET上の各言語からIronPythonスクリプトエンジン?として使用可能
  • .NETの各言語同様コンパイルして.NETアセンブリ(exeやdllのこと)を生成可能
  • IronPython自身、C♯で記述された.NET アプリケーション

 >>> import clr
 >>> clr.AddReference("System.Xml")
  • When you use ipy.exe, mscorlib.dll? and System.dll? are automatically loaded. This enables you to start using these assemblies (which IronPython itself is dependent on) without having to call clr.AddReference?-mehthods.
 >>> import System
 >>> System.Environment
 <type 'Environment'>

ウィンドウの生成

>>> import sys
>>> sys.path.append("C:\Program Files (x86)\IronPython 2.7\Tutorial")
>>> import winforms
>>> import clr
>>> clr.AddReference('System.Windows.Forms')
>>> from System.Windows.Forms import *
>>> form = Form()
>>> form.Show()
>>> form.Text="onakasuita!"

Python Tools for Visual Studio

動作環境

  • IronPython 2.6.1では.NET 4.0 RC上で動くバージョンと他のフレームワーク(.NET 2.0 SP1以上)向けという2バージョンが提供される。
  • Visual Studio 2005 SDK 4.0を入れる必要があった

リンク

参考