On 06/01/2017 07:17 AM, joannah nanjekye wrote:
> a function that returns two values something like this:
> 
> def return_multiplevalues(num1, num2):
>      return num1, num2
> 
>  I noticed that this actually returns a tuple of the values which I did
> not want in the first place.I wanted python to return two values in
> their own types so I can work with them as they are but here I was stuck
> with working around a tuple.
> 

Why not just unpack the values? E.g.

test.py
-----------------
def f(a, b):
    return a, b

a, b = f(1, 2)

print(a)
print(b)
-----------------

$ python3 test.py
1
2

Cheers,
Thomas
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to