Skip to content

Commit 3bdb4f4

Browse files
committed
Update global_&_return.rst
Removed detail stating "return a,b" is not a tuple
1 parent 626ff20 commit 3bdb4f4

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

global_&_return.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Some try to solve this problem by *returning* a ``tuple``, ``list`` or ``dict``
110110
print(profile_data[1])
111111
# Output: 30
112112
113-
But what many programmers don't know is that you can return two separate values as well. Let's take a look at an example so that you can better understand it:
113+
Or by more common convention:
114114

115115
.. code:: python
116116
@@ -119,11 +119,4 @@ But what many programmers don't know is that you can return two separate values
119119
age = 30
120120
return name, age
121121
122-
name, age = profile()
123-
print(name)
124-
# Output: Danny
125-
126-
print(age)
127-
# Output: 30
128-
129-
This is a better way to do it along with returning ``tuples``, ``lists`` and ``dicts``. Don't use ``global`` keyword unless you know what you are doing. ``global`` might be a better option in a few cases but is not in most of them.
122+
This is a better way to do it along with returning ``lists`` and ``dicts``. Don't use ``global`` keyword unless you know what you are doing. ``global`` might be a better option in a few cases but is not in most of them.

0 commit comments

Comments
 (0)