【发布时间】:2020-02-21 07:55:01
【问题描述】:
我创建了一个 Common 类,它将被共同使用,并且正在从 A 函数和 B 函数接近。
如果我在 Common 类中添加变量,则必须同时部署 A 类和 B 类。
如何在不部署所有A和B功能的情况下应用Common类生效?
class Common:
def __init__(self, tmp):
self.FIRST = tmp
self.SECOND = 'Test' # new.
# I want to modify this function.
# but I have to deploy function A and B.
# If I have a lot of functions I need a lot of time.
def print_value(self):
print(self.FIRST) # old.
print(self.FIRST, self.SECOND) # new.
class A:
def __init__(self):
o = Common('A')
o.print_value()
class B:
def __init__(self):
o = Common('B')
o.print_value()
【问题讨论】:
标签: python google-cloud-platform google-cloud-functions