self.myList.extend([0] * (4 - len(self.myList)))
This works when padding with integers. Don’t do it with mutable objects.
Another possibility would be:
self.myList = (self.myList + [0] * 4)[:4]
self.myList.extend([0] * (4 - len(self.myList)))
This works when padding with integers. Don’t do it with mutable objects.
Another possibility would be:
self.myList = (self.myList + [0] * 4)[:4]