快速入门3

函数:可以给默认值,这东西让人又爱又恨啊
def fun(i,j=2):
    print i,j
fun(3)

2,3


class AClass(object):
    """no this line will wrong!"""
    version = 1.0
def _init_(self,nm='abc'):
    """constructor"""
    self.name = nm
    print 'now,do thing,looks like constructor,but not create instance'

a=AClass()

理论上应该显示_init_,但啥都不显示...以后回头再看吧

你可能感兴趣的:(快速入门)