Python错误/:';的操作数类型不受支持;instancemethod';和';int';
我在尝试除法时收到此错误Python错误/:';的操作数类型不受支持;instancemethod';和';int';,python,debugging,Python,Debugging,我在尝试除法时收到此错误 roomRatio = max(self.getRoomWidth(), self.getRoomHeight)/8 TypeError: unsupported operand type(s) for /: 'instancemethod' and 'int' getRoomWidth/Height()返回我所在房间的整数大小 你忘了() 请注意,在Python中,通常不需要setX()或getX()方法,因为您可以这样做: class MyClass(ob
roomRatio = max(self.getRoomWidth(), self.getRoomHeight)/8
TypeError: unsupported operand type(s) for /: 'instancemethod' and 'int'
getRoomWidth/Height()
返回我所在房间的整数大小 你忘了()
请注意,在Python中,通常不需要setX()
或getX()
方法,因为您可以这样做:
class MyClass(object):
def getRoomWidth(self):
...
def setRoomWidth(self, width);
...
roomWidth = property(getRoomWidth, setRoomWidth)
要使用它
self.width = self.width * 2
你忘了()
请注意,在Python中,通常不需要setX()
或getX()
方法,因为您可以这样做:
class MyClass(object):
def getRoomWidth(self):
...
def setRoomWidth(self, width);
...
roomWidth = property(getRoomWidth, setRoomWidth)
要使用它
self.width = self.width * 2
我应该删除这个吗?我接受。@BumSkeeter你现在不能(当它对答案投了肯定票时)。。。接受它,继续前进……:)我应该删除这个吗?我接受。@BumSkeeter你现在不能(当它对答案投了肯定票时)。。。接受它,继续前进……:)