相关疑难解决方法(0)

类中的Python调用函数

我有这个代码来计算两个坐标之间的距离.这两个函数都在同一个类中.

但是如何在函数distToPoint中调用函数isNear

class Coordinates:
    def distToPoint(self, p):
        """
        Use pythagoras to find distance
        (a^2 = b^2 + c^2)
        """
        ...

    def isNear(self, p):
        distToPoint(self, p)
        ...
Run Code Online (Sandbox Code Playgroud)

python class function call

204
推荐指数
2
解决办法
34万
查看次数

标签 统计

call ×1

class ×1

function ×1

python ×1