You can use x = func()[0] to return the first value, x = func()[1] to return the second, and so on.

If you want to get multiple values at a time, use something like x, y = func()[2:4].

Answer from Luke Woodward on Stack Overflow
๐ŸŒ
Reddit
reddit.com โ€บ r/python โ€บ can a function return more than 1 value in python
r/Python on Reddit: Can a function return more than 1 value in Python
March 25, 2021 -

I'm in 11th grade. My class is having a big discussion over this. So I chose to ask you all what is the truth.

Can functions in python return more than 1 value?

I told my teacher no they can't because the function returns a tuple containing multiple values so it's technically a single object that is getting returned (when we write something like return v1,v2 ) and when we are assigning those values to variables, we are just unpacking tuples.

I really need your help. What do you think?

Edit: Thank you all for your answers. I have come to the conclusion that this debate is more semantic/linguistic than technical. I have decided to stick to what my teacher teaches me just so I can get the correct answer on the school tests.

๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ g-fact-41-multiple-return-values-in-python
Returning Multiple Values in Python - GeeksforGeeks
In Python, a function can return more than one value at a time using commas. These values are usually returned as a tuple.
Published ย  July 1, 2025
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
How to Return Multiple Values from a Function in Python | note.nkmk.me
April 23, 2025 - def test_list(): return ['abc', 100] result = test_list() print(result) print(type(result)) # ['abc', 100] # <class 'list'> ... Draw circle, rectangle, line, etc. with Python, Pillow ยท pandas: Reset index of DataFrame/Series with reset_index() Convert Unix Time (Epoch Time) to and from datetime in Python ยท NumPy: Create an array with the same value (np.zeros, np.ones, np.full)
๐ŸŒ
Flexiple
flexiple.com โ€บ python โ€บ python-return-multiple-values
Return multiple values from a function in Python | Flexiple Tutorials - Flexiple
#Returning Multiple Values using Tuples def multiple(): operation = "Sum" total = 5+10 return operation, total; operation, total = multiple() print(operation, total) #Output = Sum 15 ยท A common confusion here is that the syntax of tuple requires a pair of brackets (). Although this is true, Python does not always require brackets to identify a tuple.
Find elsewhere
๐ŸŒ
Drbeane
drbeane.github.io โ€บ python โ€บ pages โ€บ functions โ€บ returning_multiple.html
Returning Multiple Values โ€” Python for Data Science
Functions and Classes ยท It is possible for a Python function to return multiple values. To To accomplish this, we can combine the desired return values together into a list or a tuple, which we then return. Alternately, we can simply list the return values in the return statement, separated ...
Top answer
1 of 14
697

Named tuples were added in 2.6 for this purpose. Also see os.stat for a similar builtin example.

>>> import collections
>>> Point = collections.namedtuple('Point', ['x', 'y'])
>>> p = Point(1, y=2)
>>> p.x, p.y
1 2
>>> p[0], p[1]
1 2

In recent versions of Python 3 (3.6+, I think), the new typing library got the NamedTuple class to make named tuples easier to create and more powerful. Inheriting from typing.NamedTuple lets you use docstrings, default values, and type annotations.

Example (From the docs):

class Employee(NamedTuple):  # inherit from typing.NamedTuple
    name: str
    id: int = 3  # default value

employee = Employee('Guido')
assert employee.id == 3
2 of 14
270

For small projects I find it easiest to work with tuples. When that gets too hard to manage (and not before) I start grouping things into logical structures, however I think your suggested use of dictionaries and ReturnValue objects is wrong (or too simplistic).

Returning a dictionary with keys "y0", "y1", "y2", etc. doesn't offer any advantage over tuples. Returning a ReturnValue instance with properties .y0, .y1, .y2, etc. doesn't offer any advantage over tuples either. You need to start naming things if you want to get anywhere, and you can do that using tuples anyway:

def get_image_data(filename):
    [snip]
    return size, (format, version, compression), (width,height)

size, type, dimensions = get_image_data(x)

IMHO, the only good technique beyond tuples is to return real objects with proper methods and properties, like you get from re.match() or open(file).

๐ŸŒ
Medium
martinxpn.medium.com โ€บ what-are-multiple-return-values-actually-in-python-28-100-days-of-python-82821c8de24b
What are Multiple Return Values Actually in Python? (28/100 Days of Python) | by Martin Mirakyan | Medium
April 10, 2023 - Thus making it possible to write ... age, id) # Got the user data: Anna 23 anna123 ยท Yet, in reality, the language actually allows only a single return value....
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-returns-multiple-values-how-to-return-a-tuple-list-dictionary
Python Return Multiple Values โ€“ How to Return a Tuple, List, or Dictionary
July 20, 2020 - By Amy Haddad You can return multiple values from a function in Python. To do so, return a data structure that contains multiple values, like a list containing the number of miles to run each week. def miles_to_run(minimum_miles): week_1 = minimum...
๐ŸŒ
Bobby Hadz
bobbyhadz.com โ€บ blog โ€บ python-return-multiple-values-use-only-one
Return multiple values and only use One in Python | bobbyhadz
Copied!def my_func(): return ['a', 'b', 'c', 'd'] _, _, *rest = my_func() print(rest) # ๐Ÿ‘‰๏ธ ['c', 'd'] Alternatively, you can access the items you need directly. ... Call the function and access the result at a specific index if you need to get a single value.
๐ŸŒ
Real Python
realpython.com โ€บ python-return-statement
The Python return Statement: Usage and Best Practices โ€“ Real Python
June 14, 2024 - But first, try to come up with the answer on your own. Whatโ€™s the difference between explicit and implicit return statements?Show/Hide ยท An explicit return statement immediately ends the functionโ€™s execution and sends the specified value back to the caller. For example, a function can return a number, a list, or any other object. If no return statement is present, Python adds one implicitly, which returns None.
๐ŸŒ
Quora
quora.com โ€บ Is-returning-multiple-variables-in-Python-considered-poor-programming
Is returning multiple variables in Python considered 'poor' programming? - Quora
This question can be paraphrased as โ€œIs returning a tuple in Python considered โ€˜poorโ€™ programming?โ€, because that is exactly what those multiple values are - a tuple. Returning any data type cannot be considered bad practice.
๐ŸŒ
Python Basics
pythonbasics.org โ€บ multiple-return
Multiple return - Python Tutorial
Create a function getPerson(). As you already know a function can return a single variable, but it can also return multiple variables.
๐ŸŒ
datagy
datagy.io โ€บ home โ€บ python posts โ€บ python: return multiple values from a function
Python: Return Multiple Values from a Function โ€ข datagy
December 19, 2022 - However, Python also comes with an unpacking operator, which is denoted by *. Say that we only cared about the first item returned. We still need to assign the remaining values to another variable, but we can easily group them into a single variable, using the unpacking operator.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ returning-multiple-values-in-python
Returning Multiple Values in Python?
For returning multiple values from a function, we can return tuple, list or dictionary object as per our requirement. def func(x): y0 = x+ 1 y1 = x * 3 y2 = y0 ** 3 return (y0, y1, y2) However, above program get problematic as the number of values returned increases.
๐ŸŒ
Sololearn
sololearn.com โ€บ en โ€บ Discuss โ€บ 2184800 โ€บ can-a-function-in-python-return-multiple-values
Can a function in Python return multiple values? | Sololearn: Learn to code for FREE!
... Hello, no it is not possible. Only 1 value. So you must rely on tuples etc. ... Yeild generator does help you return every iteration value from loop in a function.. ... How many time is necessary to learn Python?