第9回Python3にもC拡張モジュールを─Python3.0でも使える拡張モジュール開発手法の確立 入江田昇 2009-05-07
Python 2 / 3 両対応のライブラリをメンテナンスしている人にとって、 Python 3 の メリットは享受できずメンテナンスコストだけが上がるつらい状況がずっと続いています。 しかし、「Python 3 への移行が大変」というのは、Python 2 を捨てるのが大変、 Python 2/3 両対応の ライブラリをメンテナンスするのが面倒という意味です。 アプリケーションであれば、 Python 2 対応のプロジェクトを Python 3 に対応させると同時に Python 2 への対応を切れるのでずっと楽ですし、さらに新規プロジェクトを Python 3 で始めるのは もっと楽です。 特に Web 系では、 (Google App Engine などの例外はあるものの)自分で Python のバージョンを 選べることが多いし、主要なライブラリも Python 3 対応ができている
Pythonを始めたばかりのユーザーの多くが、どちらのバージョンを使えばいいのか迷っています。私の答えは、「気に入ったチュートリアルに書かれているバージョンにしましょう。そして、あとで違いを調べてください」という言葉につきます。 それでは、新しいプロジェクトを始めるときにはどちらを選べばいいのでしょうか? 使おうとしているライブラリを全てサポートしているなら、2.7.x系と3.x系のどちらを使ってもよいでしょう。そうはいっても、この2つのメジャーバージョンについて大きな違いを見ておくのは良いでしょう。どちらかのみでコードを書いたり、プロジェクトに使おうとしている時によくある落とし穴を避けられるからです。 __future__ モジュール Python 3.x で導入されていて Python 2 で使えないキーワードについては、 __furute__ モジュールをインポートすることで Pyt
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く