__init__ 实例化对象,__init__并不相当于C#中的构造函数,执行它的时候,实例已构造出来了。
class Node:
def __init__(self, value):
self._value = value
self._children = []
# Example
if __name__ == '__main__':
root = Node(0)
print root
print type(root)
C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/Django/a31.py
<__main__.Node instance at 0x01C5BDF0>
<type 'instance'>