12. Lightweight Language
Weekend ’04
Python Language Update
Copyright c 2004 Python Japan User's Group.
Python 2.4 系列
リリース予定
• alpha: 2.4a1 (2004/7/8), 2.4a2 (2004/8/5), 2.4a3 (2004/8/19?)
• beta: 2004/8 ?
• release: 2004/9 ?
2.3 以後の新機能
– ジェネレータを書きやすく : ジェネレータ式 (generator expression)
内包表記 [x*2 for x in range(10)] → [1, 4, 9, 16, ...] に対して
(x*2 for x in range(10)) は ( 値を一括生成せず ) ジェネレータを返す
– リスト操作をもっと便利に : sorted()/reversed()
• a.sort() や a.reverse() は a を返さない (a 自体を変更してしまうため )
• 並べ替え済みのコピーを返す sorted()/reversed() 追加
– 文字コード codec を充実 : CJK codecs の追加
日中韓文字コードの codec が標準配布物に取り込まれる
– 通貨計算を扱いやすく : decimal モジュールの追加
10 進固定小数点数の正確な表現が可能に
13. Lightweight Language
Weekend ’04
Python Language Update
Copyright c 2004 Python Japan User's Group.
未確定の機能
– 関数修飾子 (function decorator)
• 静的メソッドやクラスメソッドをもっと定義しやすくする
• 構文の是非はまだ論議されているが,
とにかく @ を使った構文が 2.4a2 で
導入された
– 複数行にわたる import 文
Python 2.4 系列
class aClass:
def func(args):
...
func =
staticmethod(func)
class aClass:
*decorator* func(args):
...
>>> @staticmethod
... def func(a):
... return "hello decorator"
...
>>>
>>> func
<staticmethod object at 0x00934870>
>>>
from mymod import (foo,
bar, spam, bacon)
...
14. Lightweight Language
Weekend ’04
Python Language Update
Copyright c 2004 Python Japan User's Group.
その他
サードパーティモジュール
– モジュールインデクス PyPI: http://www.python.org/pypi/
配布ツール distutils を使った登録や更新が可能に
– Numeric は numarray へ
• コードの見直しと機能追加
• SciPy や PyOpenGL など,序々に対応へ
ドキュメント
– 和訳プロジェクトによる標準ドキュメント和訳
2.3.3 訳了版リリース (2004/6/28 - まだ改善の余地あり.協力者求
む! )
PDF, info, HTML, Windows CHM 形式で配布中
– PEP やモジュールドキュメントなど,様々な関連文書の和訳
– Python クイックリファレンス
15. Lightweight Language
Weekend ’04
Python Language Update
Copyright c 2004 Python Japan User's Group.
まとめ
Python は実は便利だ
Python makes joys of computing… !!
ご静聴ありがとうございま
した
Python はこれからもっと便利になる
一緒に Python を便利にしてゆきましょう
本家 : http://www.python.org/
日本 Python ユーザ会 : http://www.python.jp/
日本 Python メーリングリスト :
http://www.python.jp/mailman/listinfo/python-ml-jp
ドキュメント和訳プロジェクト :
http://www.python.jp/Zope/pythondoc_jp
16. Lightweight Language
Weekend ’04
Python Language Update
Copyright c 2004 Python Japan User's Group.
Acknowledgements and Copyrights
• ヘッダおよびフッタのアートワークは 柴田淳氏よりご提供いただきました
.
Copyright (c) 2004 Python Japan User's Group
• 資料中に使われているクリップアートワークは, Microsoft OfficeOnline ク
リップアートコレクションをもとに作成しました.
使用条件については http://office.microsoft.com/clipart/ をご覧ください.
• その他クリップアートを使わない図形や写真,および本文テキストの著作権
は増田泰 (ymasuda at ethercube.com) および日本 Python ユーザ会に帰属
し,以下の条件で再配布および改変を認めます.
Copyright Notice
Copyright Yasushi Masuda, Python Japan User's Group, 2004 All Rights Reserved
Permission to use, copy, modify, and distribute this product for any purpose and without fee is hereby granted, provided that above
copyright notice and this permission notice is attached with every copies or distributions.
Disclaimer
Yasushi Masuda and Python Japan User's Group (together as the author hereafter) disclaims all warranties with regard to this product,
including all implied warranties of merchantability and fitness, in no event the author shall be liable for any special, indirect or consequential
damages or any damages whatsoever resulting from loss of use, data or profits, whatever in an action pf contract, negligence or other
tortious action, arising out of or in connection with the use or derivation of this product.
The author makes any warranty, express or implied, or assumes any liability or responsibility for the accuracy, completeness, or usefulness
of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately-owned rights.
Reference herein to any specific commercial products, process, or service by trade name, trademark, manufacturer, or otherwise, does not
necessarily constitute or imply its endorsement, recommendation, or favoring by the author. The views and opinions of authors expressed
herein do not necessarily state or reflect those of the author, and shall not be used for advertising or product endorsement purposes.