A glitch with PyCharm 2023.2.1

Right, is there a valid reason as to why PyCharm is giving me the 

TypeError: Point() takes no arguments

Despite correctly coding the following:

class Point:
    def __int__(self, x, y):
        self.x = x
        self.y = y


point = Point(10, 20)
print(point.y)

Evidently there is a glitch with PyCharm which needs to be rectified. 

Stupidity at its finest. 

0

Unfortunately, it's not PyCharm that's wrong --

Class instantiation methods are defined as `__init__`. In your code, you're overriding the `int` dunder method used for representing your class as an integer. Add the ‘i’ to ‘init’ and you'll find the code evaluates as expected.

0

请先登录再写评论。