码迷,mamicode.com
首页 > 编程语言 > 详细

python 定义类时,内部方法的互相调用

时间:2020-01-26 17:41:09      阅读:85      评论:0      收藏:0      [点我收藏+]

标签:fun   highlight   sel   __init__   print   pre   方法   UNC   elf   

 

class MyClass:
    def __init__(self):
        pass
    def func1(self):
        # do something
        print(‘a‘)   #for example      
        self.common_func()
     def func2(self):
        # do something
        self.common_func()
         
     def common_func(self):
         pass

  

python 定义类时,内部方法的互相调用

标签:fun   highlight   sel   __init__   print   pre   方法   UNC   elf   

原文地址:https://www.cnblogs.com/kekeoutlook/p/12234387.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!