摘要:
Is it legal (and moral) for a member function to say delete this? As long as you’re careful, it’s okay (not evil) for an object to commit suicide (del 阅读全文
摘要:
49:了解new-handler的行为 当operator new无法满足某一内存分配需求时,它会抛出异常(以前会返回一个null)。在抛出异常之前,它会调用一个客户指定的错误处理函数,也就是所谓的new-handler。 客户通过调用set_new_handler来设置new-handler: s 阅读全文
摘要:
C++ template机制自身是一部完整的图灵机(Turing-complete):它可以被用来计算任何可计算的值。于是导出了模板元编程(TMP, template metaprogramming),创造出“在C++编译器内执行并于编译完成时停止执行”的程序。 41:了解隐式接口和编译期多态 所谓 阅读全文
摘要:
1: 变量不是盒子,应该把变量视作便利贴。变量只不过是标注,所以无法阻止为对象贴上多个标注。标注就是别名: 下面的代码中,lewis 和 charles 是别名,即两个变量绑定同一个对象。而 alex 不是 charles 的别名,因为二者绑定的是不同的对象。alex 和 charles 绑定的对象 阅读全文
摘要:
Q: Looking in /proc/$mypid/fd/, I see these files Because I have access to the code, I know these sockets are tied to TCP connections (one is a connec 阅读全文
摘要:
https://stackoverflow.com/questions/6760685/creating-a-singleton-in-python 阅读全文
摘要:
1:type() class type(object) class type(name, bases, dict) With one argument, return the type of an object. The return value is a type object. The isin 阅读全文
摘要:
一:类也是对象 在理解元类之前,你需要先掌握Python中的类。Python中类的概念借鉴于Smalltalk,这显得有些奇特。在大多数编程语言中,类就是一组用来描述如何生成一个对象的代码段。在Python中这一点仍然成立: 但是,Python中的类还远不止如此。类同样也是一种对象。是的,没错,就是 阅读全文
摘要:
What is the difference between Processor, Core, Logical Processor ? Processor : It’s the physical components that comes with server, responsible of al 阅读全文
摘要:
Python2中的multiprocessing模块,规避了GIL(Global Interpreter Lock)带来的多线程无法实际并发的缺点,设计了几乎与threading模块一模一样的API,目的就是方便我们在必要时可以使用multiprocessing模块替换threading模块达到真正 阅读全文