Cython 0.23 で色々楽になるかも

どこかのタイミングでCythonのどツボり方シリーズで書こうと思ってたことに関係する内容があるようで。

「どツボ」る理由の一つにはやっぱり、「開発支援環境」との連携がまだ不足してるから、なわけなんですが。

Cython 0.23 のベータリリースが今日(20時間前)に出てます。これが気になるんだよねぇ:

* PEP 448 (Additional Unpacking Generalizations) was implemented.
See https://www.python.org/dev/peps/pep-0448/

* Support for coverage.py 4.0+ can be enabled by adding the plugin
“Cython.Coverage” to the “.coveragerc” config file.

coverage.py と連携出来ないことはずっとわかってて、いずれ紹介しようと思ってた内容なんで、ちょっと嬉しい。まだトライしてないですけどね。

coverage.py の件に関しては、実は novice blogger: cython functions coverage using coverage.pyなんてネタをあげたヒトがいて、このパッチをちょっと新しいバージョンに追従してたことはあるんですけどね、これだけでは不十分なのよね。

PEP 448 の方も、中身ちゃんとみてないですが、Cython でのシリアライズも、ハマりネタの一つなんです。これもいつか書かないとなぁと思ってた内容です。(ただあれだな、Additional ということは、ハマりネタがハマらなくなるということではないな、きっと。)(追記参照)

そんなわけで、0.23 はちょっと大事なリリースと思う。

2015-07-22 00:50 追記
PEP 448、シリアライズとは関係なかった。こんなヤツね:

 1 >>> print(*[1], *[2], 3)
 2 1 2 3
 3 >>> dict(**{'x': 1}, y=2, **{'z': 3})
 4 {'x': 1, 'y': 2, 'z': 3}
 5 >>> *range(4), 4
 6 (0, 1, 2, 3, 4)
 7 >>> [*range(4), 4]
 8 [0, 1, 2, 3, 4]
 9 >>> {*range(4), 4}
10 {0, 1, 2, 3, 4}
11 >>> {'x': 1, **{'y': 2}}
12 {'x': 1, 'y': 2}
13 >>> {'x': 1, **{'x': 2}}
14 {'x': 2}
15 
16 >>> {**{'x': 2}, 'x': 1}
17 {'x': 1}

2015-07-30 04:50 追記
ベータ2がさっき(1時間前)にあがった:

* The builtin “type“ type is now declared as PyTypeObject in source,
allowing for extern functions taking type parameters to have the correct
C signatures. Note that this might break code that uses “type“ just
for passing around Python types in typed variables. Removing the type
declaration provides a backwards compatible fix.

* Support operator bool() for C++ classes so they can be used in if
statements.

* Installation under CPython 3.3+ no longer requires a pass of the
2to3 tool. This also makes it possible to run Cython in Python
3.3+ from a source checkout without installing it first.
Patch by Petr Viktorin.

* Coverage analysis and async/await were adapted to recent changes in
coverage.py and CPython.

3.3+で Cython を使おうとしたことがなかったのでわからないけど、それまでは 2to3 通さないといけなかったのかな? とすりゃ、これは凄くうれしいことなんだろうね。

2015-08-09 05:00 追記
ついさっき、一時間ほど前に0.23 の公式リリースがされました。