2007年12月5日 星期三

周蟒特點 -- 一段與 Ping 的對話

P: PingYeh, G: gasolin

P: 你的周蟒會唸詩嗎?不然來首小曲也不錯

G: 不會,周蟒比較宅。
周蟒會排紫微斗數盤;
周蟒會網頁開發 karringell;
周蟒會畫圖
周蟒可以寫 AVG 腳本...

P: 周蟒重點是教學?周蟒的獨特之處是什麼?

G: 目前教學是最強的特點吧。
可以用中文來 modeling 生活中的事件,將物件導向映射到生活中。
周蟒生成 python code 後執行速度也很不賴,而且可以寫中文系統腳本 @@
還有與 python 的無縫轉換。

P: 轉過去還轉得回來嗎?
G: 可以!!! 雙向轉換!!
當然,會有點不一樣,不過可以無限地互轉而且都能動

G: 話說回來....實用性也算是教學考量之一, 果然我是搞教育推廣的 Orz

生活化編程一起來 -- 用周蟒建立宅男模塊

由身邊事物開始學習物件導向,
有了周蟒,編程可以更生活化。

生活化編程這個 idea 的源起來自於一則學了 python 後就會飛起來的漫畫
http://xkcd.com/353/

在某地的討論過程中充滿了玩笑與歡樂,
發現學習 python 編程應該可以更有樂趣。


為了讓更模組更容易被理解, 所以使用周蟒.
當然也歡迎用 python 擴展:

我先丟一個基本範例,歡迎大家盡量擴展 XD


類別 宅男(男):
"""
http://zh.wikipedia.org/wiki/宅男 (通俗用法)
"""
定義 __初始化__(我):
我.知識=[keroro]

定義 把妹(我):
引發 尚未實作


聚合後完整的模塊會放在 zhpy.blogspot.com 上.

2007年12月2日 星期日

周蟒(zhpy) 1.4 Beta1 發佈, 加強本地化

周蟒(zhpy) 1.4 Beta1 發佈了 (代號 黃色節制)。
請使用 「$ easy_install -U zhpy」 命令來下載或更新周蟒版本,或前往網站查看更多關於周蟒的內容 http://code.google.com/p/zhpy/

這版本加強了許多在地化的設定

1. 試驗中的中文 traceback 支持(目前僅支援一般執行模式,不支援直譯器)
2. 初步支持測試, 可以用 測試_xxx() 這樣的函數編寫測試用例. 編成 .py 後使用 nosetests 命令測試.
3. 次要關鍵詞的修正
4. 開啟 zhpy interpreter 時判斷系統編碼自動顯示繁簡中文 banner (ex: 周蟒 1.4b1 於 darwin 基於 Python 2.5.1)。


zhpy Changelog
====================

1.4b1 (12/3/2007):
--------------------
code name: Yellow Temperance

*Changes*
* change keyword:
* '操作系统错误' instead of '作业系统错误':"OSError"
* '申明' instead of "宣告":"assert"
* "申明錯誤" instead of "宣告錯誤":"AssertionError"
* "申明错误" instead of "宣告错误":"AssertionError"
* add traceback term plugins (not functional yet)

*Features*

* while open interpreter, autodetect and show the localized banner
* experimental chinese traceback support in convertor (not support in interpreter)
* add keyword:
* "全域":"global"
* "全域變量":"globals","全域变量":"globals"
* "測試":"test", "测试":"test"
* "物件":"object", "对象":"object"
* able to test though generated python file ($ nosetests n_xxx.py)

*Fixes*

* fix triple quote bug, thanks renhbo
* allow cascading 2 identifiers (cascade 3 or more identifiers is not support)

*Project Updates*

*Contributors*

Fred Lin, renhbo

2007年11月6日 星期二

周蟒專案首頁更新

周蟒專案首頁更新了介紹訊息,
將周蟒的特性與資料以簡短的文字更清楚地介紹給大家。並提供了更多有用的連結。

http://code.google.com/p/zhpy/

2007年11月5日 星期一

好讀的程式

難看的程式我覺得是一種 bad manner, 就像在正式公開場合穿著拉塌一樣

2007年11月4日 星期日

周蟒(zhpy) 1.3 版發佈, 解壓縮即用

周蟒(zhpy) 1.3 版剛發佈了(代號 白蛇)

請使用

$ easy_install -U zhpy

命令下載或更新周蟒版本.

或前往網站查看更多關於周蟒的內容
http://code.google.com/p/zhpy/

這版本主要是增加解壓縮即用(開箱即用/Battery Included)的能力.
附帶了 pyparsing 模塊.
只要下載了源碼包(Source Pack), 解壓縮後即可直接執行

$ python interpreter.py

來直接試用周蟒直譯器. 或執行

$ python commandline.py

來執行周蟒程式或轉換 python 程式成周蟒程式. (跟一般周蟒命令列工具用法相同)

只有想要用中文系統腳本或隨處可執行周蟒的情況下才一定得安裝周蟒.

就像漫畫 jojo 冒險野郎中的白蛇能抽取替身能力者的能力成為 Disc, 將Disc放到任何人身上這個人就立即擁有該替身能力一樣.

另一個特點是模塊包更獨立. 繁簡中文插件包是分開的.
你可以從源碼包中刪掉用不著的簡體中文插件(plugcn.py), 周蟒仍能正常執行.

或是從源碼包中單獨取出 interpreter.py(直譯器), zhpy.py(核心), zhdc.py(關鍵詞轉換庫), plugtw.py (繁中插件) 四個檔(如果沒裝 pyparsing 的話也要拷貝 pyparsing.py), 執行

$ python interpreter.py

也能執行有限功能的周蟒(zhpy core).

zhpy Changelog
====================

1.3 (11/5/2007):
--------------------
code name: White Snake

*Changes*

* Separate traditional and simplified chinese keywords from zhdc to plug[lang].py
* moveout plugins' setuptools dependency, now you can try zhpy without install.
* change keyword:
* "引用錯誤", "引用错误" instead of "参考错误":"ReferenceError"
* make py_annotator work while only plugtw or plugcn exists.

*Features*

* support custom name space in zh_exec, thanks renhbo
* able to run the commandline without install
* able to run the interpreter with 4 module ["interpreter", "zhpy", "zhdc", "plug[lang]"]
without install (core mode)
* able to profiling standalone interpreter with "--profile" option

*Fixes*

* fix keyword "locals" instead of "local"
* generate proper profix while the origin source is suffixed with '.tw.py' or '.cn.py'

*Project Updates*

* include pyparsing in distribution
* doc update
* add official zhpy blog: http://zhpy.blogspot.com/
* remove zhpy_ext sample

*Contributors*

Fred Lin, renhbo