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)

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

Stupidity at its finest. 

1 comment

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.


Please sign in to leave a comment.