I got class Z which has 5 attributes:
- ID
- actual x
- actual y
- future x
- future y
actual x and actual y I can replace using Position class(using class inheritance). The problem is that I want to replace future position using same method. How can I do it to avoid namespace conflict? Do I really need to create new Position class with slightly changed namespace ?
I know I can do (but i dont like this solution):
class Position: def __init__(self,x , y): self.x = x self.y = y class Position2: def __init__(self,x , y): self.fx = x self.fy = y class Z(Position,Position2): def __init__(self, x, y, f_x, f_y, Id): super().__init__(x, y) super().__init__(f_x,f_y) self.Id = Id actual code:
class Position: def __init__(self,x , y): self.x = x self.y = y class Z(Position): def __init__(self, x, y, f_x, f_y, Id): super().__init__(x, y) self.Id = Id I would like to get something like:
class Position: def __init__(self,x , y): self.x = x self.y = y class Z(Position): def __init__(self, x, y, f_x, f_y, Id): super().__init__(x, y) super().__init__(f_x, f_y) self.Id = Id that I could easy print actual and future parameters.
Z? Is it a thing with two positions? or a Position with two positions?