I have a class method with the following signature:
def UpdateColor(self, color: Tuple[float, float, float]):
I'm trying to call it with arguments coming from a list of strings. I use a list comprehension to cast them to float and then cast the whole list to a tuple:
color = tuple([float(x) for x in args[:3]])
When I'm calling the method with the color variable PyCharm complains about its type:
Expected type 'Tuple[float, float, float]' got 'Tuple[float, ...]' instead
The code analysis can't seem to be able to guess the size of the tuple. I can fix this warning by explicitly casting each string to a float and inserting them into a tuple but it's pretty ugly and will be even worse with more parameters:
color = (float(args[0]), float(args[1]), float(args[2]))
Is there a "good" way to do what I'm trying to do?
I'm using Python 3.7.8 and PyCharm 2021.1.1.