Skip to content

Commit

Permalink
Merge pull request #113 from ssundarraj/master
Browse files Browse the repository at this point in the history
Add idomatic way to retrieve multiple return values.
  • Loading branch information
yasoob committed Mar 21, 2016
2 parents dc63b2a + 21be0dd commit 0e65b48
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions global_&_return.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,10 @@ Or by more common convention:
age = 30
return name, age
profile_name, profile_age = profile()
print(profile_name)
# Output: Danny
print(profile_age)
# Output: 30
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 comments on commit 0e65b48

Please sign in to comment.