我是Python新手。从基类调用函数
我有一个类有一些常见的定义,将用于模块中的其他几个类。这是我的程序的当前结构。
class A(object):
def __init__(self, x, y):
"""Initialization method"""
super(A, self).__init__()
self.x = x
self.y = y
def function_1(self, ftype):
<<<some steps>>>
return abc
def function_2(self, stype):
<<<some steps>>>
return xyz
class B(A):
def __init__(self, x, y, e_type):
A.__init__(self, x, y)
self.e_type = enablement_type
def function_3(self, mtype):
<<<some steps>>>
**HERE I need to call the function1 and function2 of class A**
1:打电话是从基类中的功能
A.function1(self, ftype='new')
A.function2(self, stype='new')
是正确的方法是什么? Pylint说,当我这样做的时候一切都很好。
2:另外,你能在简单的条件,并请
我会建议您[ “Python入门”(https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjc9s7tv73TAhXKrY8KHZ_oAxwQFggiMAA&url=http% 3A'2F%2Fstock.ethop.org%2Fpdf%2Fpython%2FLearning%2520Python%2C%25205th%2520Edition.pdf&usg = AFQjCNH2hxNCd_36JzxBTsnu2R8238dF_A&sig2 = FcfkvLSeVGgY1OqEDEEENQ)Oops page 781 Part VI –