Python 将父类的实例变量作为函数的参数传递给内部类

Python 将父类的实例变量作为函数的参数传递给内部类,python,python-3.x,Python,Python 3.x,在FactsheetExporter中,我有数据实例变量。我需要将数据作为实例变量传递给参数类,但不知道如何传递。你知道怎么做吗 class FactsheetExporter: def __init__(self): self.data = {somedata...} class Parameter: def __init__(self): self.data = data def compute(self): do_

FactsheetExporter
中,我有
数据
实例变量。我需要将
数据
作为实例变量传递给
参数
类,但不知道如何传递。你知道怎么做吗

class FactsheetExporter:
    def __init__(self):
        self.data = {somedata...}

class Parameter:
    def __init__(self):
        self.data = data

    def compute(self):
        do_stuff(self.data)
        # do data stuff...

class PortfolioFactsheetExporter(FactsheetExporter):
    class Meta(FactsheetExporter.Meta):
        name = "export_portfolio_factsheets"
        entities = Parameter()

data
这里是类
FactsheetExporter
的实例变量。因此,您必须将
FactsheetExporter
的实例发送到
参数
,以便能够访问
数据

class FactsheetExporter:
    def __init__(self):
        self.data = {somedata...}

class Parameter(FactsheetExporter):
    def compute(self,FactsheetExporter_var):
         data = FactsheetExporter_var.data
         # do data stuff...


object1 = FactsheetExporter()
#Object1 should be passed to Parameter in order for it to be able to access data variable
object2 = Parameter(object1)
object2.compute(value_for_data)

在标题中使用“元类”一词,但代码中没有元类。有一个名为
Meta
的类。那该怎么办?这些类之间所需的关系并不十分清楚。你能准确描述一下这些关系应该是什么吗?谢谢。但我不能踢出这门课