[导入]python中类的静态方法

python中除了最常用类实例方法外,还有类方法和静态方法两种。
##############################
#类方法
##############################
class Foo:
        str = "I'm a static method."

        @classmethod     #方法修饰符——指明该方法为类方法
        def bar(cls):         阅读全文
类别:程序设计 查看评论
文章来源:http://hi.baidu.com/chaseagle/blog/item/cc97eb03ac06a58ed43f7cd7.html
posted @ 2008-08-26 22:55  chaseagle  阅读(532)  评论(0)    收藏  举报