程序人生

          撰寫生活代碼,等待編譯美好人生
          隨筆 - 48, 文章 - 0, 評論 - 29, 引用 - 0
          數據加載中……

          2007年12月5日

          Python為自身模塊添加屬性

          試了好半天才始出來,幾經曲折,所以寫下來:

          A模塊:
          1?import?sys,?os
          2?selfMod?=?__import__(__name__)
          3?setattr(selfMod,?"field",?"value")


          在B模塊中調用
          1?import?A
          2?print?A.field
          輸出: value

          模塊A的這種寫法與在模塊A中直接寫field = "value"的效果是一樣的。這看起來似乎多余,但是在某些特殊的情況下可以用該方法動態設置當前模塊的屬性。



          posted @ 2008-05-20 02:21 405 Studio 閱讀(783) | 評論 (0)編輯 收藏

          蔬菜沙拉

          前幾天跟朋友去吃了一次蔬菜沙拉。做的很精致,但并不合我的口味,但朋友很喜歡。
          今天閑暇之際研究一下“沙拉”的來源:
          google了一下"define:沙拉"

          沙拉(香港稱為沙律)通常是配菜,有時會作為一道主菜。?

          不詳細,在answers.com找了一下:

          Originally?derived?from?the?Latin?sal? for ?salt,?meaning?something?dipped?into?salt.?Now?normally?a?dish?of?uncooked?vegetables;?either?a?mixed?salad?or?just?one?item?(commonly?lettuce?or?tomato).?
          的確,我們吃的都是卷心菜(當時我以為卷心菜就是生菜 -_-|||)和小西紅柿。

          食物文化百科:
          Although?the?ancient?Greeks?and?Romans?did?not?use?the?word?"salad,"?they?enjoyed?a?variety?of?dishes?with?raw?vegetables?dressed?with?vinegar,?oil,?and?herbs.?Pliny?the?Elder?in?Natural?History,?for?instance,?reported?that?salads?(acetaria)?were?composed?of?those?garden?products?that?"needed?no?fire?for?cooking?and?saved?fuel,?and?which?were?a?resource?to?store?and?always?ready"?(Natural?History,?XIX,?58).?They?were?easy?to?digest?and?were?not?calculated?to?overload?the?senses?or?stimulate?the?appetite.
          ...........
          ...........

          最終,我在懷疑是不是中國涼拌傳入西方之后變味了的結果。

          posted @ 2007-12-05 01:43 405 Studio 閱讀(440) | 評論 (1)編輯 收藏

          主站蜘蛛池模板: 石台县| 南漳县| 阳原县| 铜梁县| 许昌市| 平和县| 子长县| 和田市| 广昌县| 始兴县| 泉州市| 巴中市| 上蔡县| 平顶山市| 新干县| 淮安市| 乌拉特前旗| 丹阳市| 凤山市| 麻城市| 隆尧县| 南漳县| 安西县| 漳平市| 班戈县| 克山县| 长宁县| 扬中市| 永康市| 炉霍县| 玛曲县| 莫力| 军事| 东乌| 宽城| 苍溪县| 石门县| 温泉县| 那坡县| 沂水县| 龙南县|