为什么方法中的代码会重复运行?

问题描述 投票:0回答:0

enter image description here

    def step(self, t, action):
        done = (True if (self.state == self.T) else False)
        self.state += 1
        self.S[self.state] = self.lFn()
        return self.state, self.getReward(t, action), done

※语言: Python (3.9)
※问题: 是我班上的一个方法。当截取的代码(图中)运行时,图中第140-141行(或前两条赋值语句)会连续运行两次。

我很少用python写面向对象的内容。 我的代码有什么问题,还是由于 python 内核的性质? 如果需要额外的代码来帮助诊断,请给我留言:) 我第一个问问题!非常感谢!

python reinforcement-learning
© www.soinside.com 2019 - 2024. All rights reserved.