I'm currently writing a script, which at some point needs to compare numbers provided to the script by two different sources/inputs. One source provides the numbers as integers and one source provides them as strings. I need to compare them, so I need to use either str() on the integers or int() on the strings.
Assuming the amount of conversions would be equal, would it be more efficient to convert the strings into integers or vice versa?
I don't really know what you exactly mean by "compare", but if it is not always only strict egality you'd better work with integers. You could need to sort your data or whatever, and it will be easier this way !
More efficient to convert string to int or inverse?