Re: Python 2.6

看板Python作者 (渴望平凡的幸福)時間16年前 (2008/10/05 00:16), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《mythnc (迷小心)》之銘言: : http://www.python.org/download/releases/2.6/ : 今天才剛剛開始看Python的入門書 : 剛剛好要找Python的資料看到的 ^^" : 不知道要不要ubuntu內的Python 2.5.2升級到2.6 ? : 2.6好像是到Python 3的過渡版本... : 有人試過2.6了嗎? 2.6 拉了好幾個有用的新東西進來 ... 下面是 2.6 what's new 裡面我覺得對我來說比較有用的東西摘錄 用法跟 threading 很像的 multiprocessing module 新的字串格式化語法 (這個等好久了 O_Q) >>> "User ID: {0}".format("root") 'User ID: root' >>> import mimetypes >>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map) 'Content-type: video/mp4' >>> fmt = '{0:15} ${1:>6}' >>> fmt.format('Registration', 35) 'Registration $ 35' >>> fmt.format('Tutorial', 50) 'Tutorial $ 50' >>> fmt.format('Banquet', 125) 'Banquet $ 125' 多用 as 關鍵字,更不容易混淆的 exception 語法 try: .... except (TypeError, ValueError) as e: .... 簡化物件屬性程式碼,新的 @getter, @setter, @deleter decorator class C(object): @property def x(self): return self._x @x.setter def x(self, value): self._x = value @x.deleter def x(self): del self._x class D(C): @C.x.getter def x(self): return self._x * 2 @x.setter def x(self, value): self._x = value / 2 新的 I/O module, PYTHONIOENCODING 環境變數 Abstract Base Class (這個有沒有人要解說一下? XD) 不過我常拿來幹壞事的 new module 被 deprecate 了 ... 得看看要改用什麼作法 _A_ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.117.40.88

10/05 22:34, , 1F
小把玩了一下 ABCs: http://0rz.tw/b54R4
10/05 22:34, 1F
文章代碼(AID): #18vvRVzS (Python)
討論串 (同標題文章)
本文引述了以下文章的的內容:
4
6
16年前, 10/04
完整討論串 (本文為第 2 之 2 篇):
1
1
16年前, 10/05
4
6
16年前, 10/04
文章代碼(AID): #18vvRVzS (Python)