[ python ] IronPython1.1 正式版リリース
IronPython v1.1 is a minor update to IronPython including both new functionality as fixes for the most voted for bugs. The new functionality in v1.1 includes several new modules (array, SHA, MD5, and select), support for .NET XML Doc comments within the help system and doc tags, as well as support for loading cached pre-compiled modules. This release improves compatibility with CPython and gives the .NET developer a better interactive experience.
IronPython v1.1 はこれまでに報告されたバグのほとんどを修正して、いくつか新しい機能を追加したマイナーバージョンアップだ。いくつか新しいモジュール ( array, SHA, MD5, select モジュール ) を追加することで機能を追加したほか、.NET Framework のヘルプシステムにおける XML Doc コメントと doc タグもサポートした。そして pre-compiled モジュールも利用できるようにした。 v1.1 で CPython との互換性が向上した。.NET でもっと簡単に開発できるようになっているだろう。
( CodePlex/IronPython, 1.1 release note より抜粋 )
かなりの意訳ですが、大意は外していないと思います (´・ω・`)b
リリースノートを見ると "Support importing pre-compiled modules produced when running in –X:SaveAssemblies mode" と書かれているので pre-compiled モジュールというのは CPython の .pyc といったファイルではなくて .NET アセンブリをサポートするようになったということみたい。
IronPython は CPython2.4.3 との互換性を意識して作られたものですが、変更履歴を見ると CPython2.5 の機能もいくつかサポートされるようになっています。IronPython1.1 では try-except-finally がサポートされるようになり ( CPython2.4 では except と finally は同時に使えなかった )、finally ブロック内の yield が使えるようになったようです。
いま動かしていますが、確かに CPython との互換性が向上しています。たとえば IronPython1.0.1 では calendar モジュールが使えませんでした。IronPython の世界では使えると書いてありますが、わたしの環境下では使えません。モジュールのインポートはできるのですが、calendar.month() メソッドを呼び出すと次のようになります。
C:\dev>ipy -X:Python25
IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import calendar
>>> print calendar.month( 2007, 4 )
Traceback (most recent call last):
File , line 0, in <stdin>##113
File C:\SDK\Python25\Lib\calendar.py, line 324, in formatmonth
File C:\SDK\Python25\Lib\calendar.py, line 204, in monthdays2calendar
File , line 0, in Initialize##130
File C:\SDK\Python25\Lib\calendar.py, line 172, in itermonthdays2
File C:\SDK\Python25\Lib\calendar.py, line 159, in itermonthdates
TypeError: unsupported operand type(s) for -: 'date' and 'timedelta'
同じコードを IronPython1.1 で実行すると次のようになります。ソースを解析したわけではないので推測になりますが、たぶん datetime モジュール ( datetime.date と datetime.timedelta かな?) のバグが修正されたので使えるようになったのでしょう。
C:\dev\IronPython-1.1>ipy -X:Python25
IronPython 1.1 (1.1) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import calendar
>>> print calendar.month( 2007, 4 )
4月 2007
月 火 水 木 金 土 日
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
しかし、インタラクティブモードでリストとタプルの複数行定義ができないのは相変わらず (-_-;;
リストとかタプルを複数行で定義しようとすると SyntaxError が発生してしまいます↓
C:\dev\IronPython-1.1>ipy -X:Python25
IronPython 1.1 (1.1) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> test_list = [
Traceback (most recent call last):
SyntaxError: unexpected token <eof> (<stdin>, line 1)
>>> test_tuple = (
Traceback (most recent call last):
SyntaxError: unexpected token <eof> (<stdin>, line 1)
IronPython では1行に入力できる文字数にも制限があるし、なにより見難くなってしまいます。リストとタプルの複数行定義もサポートするようになるとインタラクティブモードがもっと使いやすくなるでしょう。次のアップデートではサポートしてほしいですね。
2007/04/19
ものすごい誤記を修正 orz
| 固定リンク
この記事へのコメントは終了しました。
コメント