My colleague argues with me about whether we should or not add ( and ) when a function  returns a tuple:def gravity(self):      lat = sum([o.user_location[0] for o in self.orders]) / len(self.orders)                 lat = sum([o.user_location[0] for o in self.orders]) / len(self.orders)      lng = sum([o.user_location[1] for o in self.orders]) / len(self.orders)                 lng = sum([o.user_location[1] for o in self.orders]) / len(self.orders)      return lat, lng  # or return (lat, lng)We also read PEP8 and Google code style guide.
what is the right code style to return multi values in a function
python
When you return multiple values separated by commas, Python creates a tuple for them. This is true whether  you wrap or not the output values with parentheses:>>> def func1():...     a = 1...     b = 2...     return a, b... >>> func1()(1, 2)>>> type(func1())<type 'tuple'>>>> def func2():...     a = 1...     b = 2...     return (a, b)... >>> func2()(1, 2)>>> type(func2())<type 'tuple'>>>> So the pythonic way to return multiple values is to separate them by commas. If you want to wrap those values using parentheses in order to inform the reader of your code that the return value is a tuple, then it all depends who is the audience of your code: if you are teaching Python coding for beginners, maybe the parentheses are not that necessary: a comment will be even more clear to them. If the reader of your code is rather your colleague at workplace then you are not supposed to teach them using parentheses that returned multiple values constitute a tuple. You do not need parentheses there.