by Xiaokang Zhang | Jun 16, 2018 | Computer Science
Iteration Python support iteration, for example, iterating over a list: for elem in [1, 2, 3]: print elem Iterating over a dict: for key in {‘Google’: ‘G’, ‘Yahoo’: ‘Y’, ‘Microsoft’: ‘M’}: print...
by Xiaokang Zhang | Jun 12, 2018 | Computer Science
Python supports context management. Which often used when handling resources, for example, file, network connection. With statement helps make sure the resources are cleaned up or released. There are two major functions for context management: __enter__ and __exit__....
by Xiaokang Zhang | Jun 9, 2018 | Computer Science
The following is an example of python closure. def outer_function(outter_arg): closure_var = outter_arg def inner_function(inner_arg): print(“{} {}”.format(closure_var, inner_arg)) return inner_function # Usage of a python closure closure_func =...
by Xiaokang Zhang | Jun 4, 2018 | Sociology
为什么不同国家不同地区的文化相差如此之大?为什么当代的文化与古代甚至近代的文化这么不同?文化的演进是完全随机的吗?还是说存在着某种共同的推动力量?...
by Xiaokang Zhang | Feb 20, 2018 | Philosophy
《写给无神论者》是英国哲学家阿兰-德波顿的作品。这本书想要讨论的是:宗教能否为现代人心灵问题的解决提供启示。 我们首先注意到的是宗教在人们生活中的退潮。随着自然科学的兴起、发展和普及,诸如宇宙大爆炸起源假说、生物进化等观点越来越多地被普通人接受并习以为常。这些观念与宗教当中超自然的部分:关于宇宙形成的解释、违反物理准则的神迹等等相互冲突。而正是在这样的冲突之下,越来越多人选择放弃宗教信仰。...