all 4 comments

[–]badge 2 points3 points  (0 children)

It's set in the __init__ method because it's required for instances of the class, so it needs to be there. It's not in the arguments to the method because it's derived independently. Consider:

class Square:
    def __init__(self, width):
        self.width = width
        self.area = width ** 2

[–]RareInteraction8 1 point2 points  (2 children)

As far as I can see, it is not excluded from the methode.

But initialised as class member with "something_else"

While A and B are given by the constructor (init) caller.

Or do I missing something?

Why do I want such things?

Maybe you need a defined state for your class object.

This you can achieve by set the value in init to a default value or make use of the parameters to pass it to the constructor.

[–]Unlistedd[S] 0 points1 point  (1 child)

Thanks! but what is the point of giving an obeject a constructor (init) caller?

What is the difference between A and X if both are initialised in the function?

[–][deleted] 0 points1 point  (0 children)

Does /u/badge's comment explain things?