程序人生

撰写生活代码,等待编译美好人生
随笔 - 48, 文章 - 0, 评论 - 29, 引用 - 0
数据加载中……

2007年12月3日

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 阅读(763) | 评论 (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 阅读(413) | 评论 (1)编辑 收藏

感觉我是無賴

这种感觉不好。。

posted @ 2007-12-03 22:04 405 Studio 阅读(249) | 评论 (0)编辑 收藏