2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Python2.5でsixを使う際の注意点

Last updated at Posted at 2015-12-31

Python 2.5が動作する環境下で動くpythonスクリプト中でsixを使う際の注意点。

sixとは

sixが何かは公式ドキュメントを参照。
Six: Python 2 and 3 Compatibility Library — six 1.10.0 documentation

Six provides simple utilities for wrapping over differences between Python 2 and Python 3. It is intended to support codebases that work on both Python 2 and 3 without modification. six consists of only one Python file, so it is painless to copy into a project.

公式リポジトリ(gutworth / six — Bitbucket)
現時点(2015/12)で最新版は1.10.0

公式ページの日本語訳は現時点で1.9.0まで。
Six: Python 2 と 3 の互換性ライブラリ — six 1.9.0 ドキュメント

結論

Python 2.5環境でも動かす可能性がある場合は six 1.8.0 を使用する。

詳しく

1.10.0ではPython 2.5はサポート対象外となっている。

six 1.10.0 : Python Package Index

Six supports every Python version since 2.6. It is contained in only one Python file, so it can be easily copied into your project. (The copyright and license notice must be retained.)

1.9.0ではPython 2.5はサポート対象となっている。

six 1.9.0 : Python Package Index

Six supports every Python version since 2.5. It is contained in only one Python file, so it can be easily copied into your project. (The copyright and license notice must be retained.)

ところが、Python 2.5で動かない operator.methodcaller を使っている。
ソース差分を見ると、1.8.0 -> 1.9.0 でoperator.methodcallerを使うように修正されている。

というわけで、Python 2.5もサポートする場合はsix 1.8.0を使用しましょうというお話。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?