15,743,609 members
See more: , +
Python
```  1  class cl:
2      def __init__(self,x,y):
3          self.x = x
4          self.y = y
5      def multiply(self,n):
6          self.x = self.x * n
7          self.y = self.y * n
8
9  class Cam(cl):
10      def __init__(self,g,x,y):
11          self.g = g
12          super().__init__(x,y)
13
14
15  if __name__ == "__main__":
```

the ouput:
```m.x is : 2 ## m.y is : 3
m = Cam(1,2,3)
print('m.x is :',m.x,'##','m.y is :' ,m.y)```

What I have tried:

I am trying let my code print:
`m.x is : 2 ## m.y is : 3`

it does it correctly, but I noticed when I exchange x and y in the line 12 it gives me the output:
`m.x is : 3 ## m.y is : 2`

even though they remain in the line 10 in the order g,x,y.

Do you know why and which mechanism stands behind it (or what happens behind the scenes?)
Posted
Updated 10-Jul-20 1:20am
v2

## Solution 1

Of course it does, as you are passing parameters by position and not by name. So if you reverse the order in line 12 then they will be reversed when they are received by c1's constructor.
If you want the values to be referred to by name then your code needs to be:
Python
```class cl:
def __init__(self,x=0,y=0):
self.x = x
self.y = y
def multiply(self,n):
self.x = self.x * n
self.y = self.y * n

class Cam(cl):
def __init__(self,g,x=0,y=0):
self.g = g
super().__init__(x=x, y=y) # the order for x and y can be changed```